The text of a manual · part 7 of 18
8840A Digital Multimeter Instruction Manual, pages 61 to 70
Pages 61 to 70 of 180
The original document is the PDF (42 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.
For the Fluke 8840A
Page 61
Remote Programming EXAMPLE PROGRAMS
10 REM The following application program is written in BASICA for the IBM PC, PC-XT or
20 REM PC-AT. The National Instruments Model GPIB-PCIIA board provides the interface
30 REM between the PC and the Fluke 8840A DMM. The program assumes that the configuration 40 REM program IBCONF has been mun to initialize the interface board with the device
50 REM name 18840A assigned to the GPIBO board.
60REM
70 REM The first 6 lines of code are required to properly link the NI drivers to BASICA.
80 REM
90 REM
100 REM This program selects VDC (F1), Autorange (RO), Slow rate (SO), Continuous trigger (TO) 110 REM and suffixes enabled (Y1). The program takes 10 readings, displays them on the screen, 120 REM and then stops.
130 REM
140 REM
150 CLEAR ,59736!
160 IBINIT1 = 59736!
170 IBINIT2 = IBINIT1 + 3
180 BLOAD "bib.m",IBINIT1
190 CALL IBINIT1 (BFIND,IBTRG,IBCLR,IBPCT ,IBSIC,IBLOC, IBPPCIBBNA,IBONL,IBRSC, IBSRE, IBRSV,IBPAD,IBSAD [BIST ,IBDMA,IBEOS,IBTMO,IBEOT, IBRDF,IBWRTF)
200 CALL IBINIT2(IBGTS,IBCAC,IBWAIT IBPOKE,IBWRT. IBWRTA,IBCMD,IBCMDA,IBRD, IBRDA,IBSTOP,
IBRPP,IBRSP,IBDIAG, IBXTRC,IBRDIIBWRTI ‘IBRDIAIBWRTIAIBSTA%, IBERR%,IBCNT%) 210 REM
220 REM - IBM BASICA on IBM PC, PC-XT or PC-AT
230 REM
240 DEVNAME$="I8840A" *Device name is I8840A
250 CALL IBFIND(DEVNAME$,DVM%) ‘Initialize the DMM
260 CALL IBCLR(DVM%) *Clear the device |
270 FOR W=1 TO 500: NEXT W "Wait 1 second before sending command 280 WRT$="F1IROSOTOY1"
290 CALL IBWRT(DVM%,WRT$) "Write functions to instrument
300 FORI = 1TO 10
310 RD$=SPACE$(18) "11 characters for the reading, 5 for the 320 ’suffix and 2 for the terminators
330 CALL IBRD(DVM%,RD$) "Get data from 8840A
340. PRINT I, LEFT$(RD$,16) Print to display
350 NEXT I
360 END
IBM®, IBM PC, PC-XT and PC-AT are registered trademarks of Internatidnal Business Machine Corporation
National instruments® is a registered trademark of National instruments ‘Corporation
3-26
Figure 3-14. Example Programs: Using the IBM PC®
Page 62
EXAMPLE PRO:
Remote Programming.
10 REM The following application program is written in BASICA for the IBM PC, PC-XT or
20 REM PC-AT. The National Instruments Model GPIB-PCIIA board provides the interface
30 REM between the PC and the Fluke 8840A DMM. The program assumes that the configuration. | 40 REM program IBCONF has been mun to initialize the interface board with the device 50 REM name I8840A assigned to the GPIBO board.
60 REM .
70 REM The first 6 lines of code are required to properly link the NI drivers to BASICA.
80 REM ;
90 REM This program illustrates one possible use of the serial poll register. In this
100 REM case it is merely looking for data available. The function of the program is to
110 REM display on the screen the lowest resistance value measured on the input terminals
120 REM of the 8840A using the 2-wire ohms function in autorange. The range and function
130 REM commands are programmed using the Put Instrument Configuration (P0) command.
140 REM
150 CLEAR 59736!
160 IBINIT1 = 59736!
170 IBINIT2 = IBINIT1 + 3
180 BLOAD "bib.m’,IBINIT1
190 CALL IBINIT1 (IBFIND,IBTRG,IBCLR,IBPCT,IBSIC,IBLOC,IBPPC,IBBNA,IBONL,IBRSC,IBSRE, IBRSV,IBPAD,IBSAD, IBIST,IBDMA,IBEOS,IBTMO, IBEOT , IBRDF,IBWRTF) 200 CALL IBINIT2(IBGTS,IBCAC,IBWAIT,IBPOKE,IBWRT,IBWRTA,IBCMD,IBCMDA,IBRD,IBRDA IBSTOP, IBRPP,IBRSP,IBDIAG,IBXTRC,IBRDI,IBWRTI,IBRDIA,IBWRTIA,IBSTA%, IBERR% IBCNT %) . 210 REM ,
220 REM IBM BASICA on IBM PC, PC-XT or PC-AT
230REM rcs * eee 8 :
240 DEVNAME="18840A" "Device name is 18840A
250 CALL IBFIND (DEVNAME$,DVM%) Initialize the DMM
260 CALL IBCLR (DVM%) *Clear device
270 FOR W = 1 TO 500: NEXT W "Wait 1 second before sending commands 280 WRT$ = "N3001P0 Y1 ?"
290 CALL IBWRT (DVM%,WRT$) "Write functions to instrument
300 RD$ = SPACE$(18) "11 characters for the reading, 5 for the 310 suffix and 2 for the terminators
320 CALL IBRD (DVM%,RD$) Get first reading from 8840A
330 R = VAL(RDS) | 340 PRINT LEFT$ (RD$,16);"S (2-WIRE) LOWEST READING" ‘Display readings
350 WRT$ = "?"
360 CALL IBWRT (DVM%,WRT$) "Trigger the 8840A
370 CALL IBRSP (DVM%,SPR%) ’Get serial poll byte
380 IF SPR% AND &H40 <> &H40 THEN 370 ’Check for data available 390 RD$ = SPACE$(18) . : 400 CALL IBRD (DVM%,RD$) *Get next data
410 S = VAL (RD$)
420 IF S >= R THEN 350 Throw away data if not lowest 430R=S *Update lowest reading 440 GOTO 340 Print new low
450 END
Figure 3-14. Example Programs: Using the IBM pc® (cont) 3-27
} i re as
Page 63
Remote Programming EXAMPLE PROGRAMS
10 REM The following application program is written in BASICA for the IBM PC, PC-XT or
20 REM PC-AT. The National instruments Model GPIB-PCIIA board provides the interface 30 REM between the PC and the Fluke 8840A DMM. The program assumes that the configuration | 40 REM program IBCONF has been run to initialize the interfabe board with the device 50 REM name I8840A assigned to the GPIBO board.
60 REM
70 REM The first 6 lines of code are required to properly link the NI drivers to BASICA.
80 REM
90 REM This program selects VDC (F1), Autorange (RO), Slow rate (SO), Continuous trigger (TO) 100 REM and suffixes enabled (Y1). All readings appear simultaneously on the instrument
110 REM display and the PC screen with suffixes enabled for function readout. Full local
120 REM control is given to the 8840A. Note the local control must be given to the board
130 REM and not the device. Press <CTRL> BREAK to terminate this program.
140 REM
150 CLEAR ,59736!
160 IBINIT1 = 59736!
170 IBINIT2 = IBINIT1 + 3
180 BLOAD "bib.m",IBINIT1
190 CALL IBINIT1 (BFIND,IBTRG,IBCLR,IBPCT, IBSIC,IBLOC,IBPPC, IBBNA,IBONL,IBRSC,IBSRE, IBRSV,IBPAD, IBSAD, IBIST,IBDMA,IBEOS, IBTMO, IBEOT. IBRDF,IBWRTF)
200 CALL IBINIT2(IBGTS,IBCAC, IBWAIT, IBPOKE,IBWRT,IBWRTA,IBCMD, IBCMDA,IBRD,IBRDA,IBSTOP, IBRPP,IBRSP,IBDIAG, IBXTRC,IBRDI,IBWRTI ABRDIA,IBWRTIA, IBSTA%, IBERR%,IBCNT%)
210 REM 220 REM IBM BASICA on IBM PC, PC-XT or PC-AT 230 REM 240 BDNAME$="GPIBO" *Board name is GPIBO 250 CALL IBFIND (BDNAME$,BD%) ‘Initialize the interface board 260 DEVNAME="18840A" "Device name is I8840A 270 CALL IBFIND (DEVNAME$,DVM%) ‘Initialize the DMM 280 CALL IBCLR (DVM%) *Clear device 290 FOR W = 1 TO 500: NEXT W "Wait 1 second before sending commands ' 300 WRT$ = "FIROSOTOY1" *F1=VDC, RO=autorange, SO=slow rate 310 *TO=continuous trig., Yl=enable suffix 320 CALL IBWRT (DVM%,WRTS) *Write functions to instrument 330 CALL IBLOC (DVM%) ’Give local control to instrument 340 V% = 0:X% =0 350 CALL IBSRE (BD%,V%) ‘Deassert the remote enable (REN) 360 ’so the 8840A stays in local when a call 370 ‘to IBRD is made 380 RD$ = SPACE$(18) "11 characters for the reading, 5 for the 390 ’suffix and 2 for the terminators 400 CALL IBRD (DVM%,RD$) ’Get data from 8840A 410 X% = X% +1 420 PRINT X%, LEFT$ (RD$,16) ‘Display readings 430 GOTO 380 440 END 3-28 Figure 3-14. Example Programs: Using the IBM pc cont)
Page 64
Remote Programming “EXAMPLE PROGRAMS
10 REM The following application program is written in BASICA for the IBM PC, PC-XT or
20 REM PC-AT. The National Instruments Model GPIB-PCIIA board provides the interface
30 REM between the PC and the Fluke 8840A DMM. The program assumes that the configuration . 40 REM program IBCONF has been run to initialize the interface board with the device
50 REM name I8840A assigned to the GPIBO board.
60 REM
70 REM The first 6 lines of code are required to properly link the NI drivers to BASICA.
80 REM
90 REM This program illustrates a method of recording any errors produced by the 8840A
100 REM selftest function. It should be noted that:
110 REM 1. If more than one digital error occurs, only the last one will be reported.
120 REM 2. The response to a Get Instrument Config. (GO) command during selftest is "9xxx". 130 REM 3. The response to a Get Error Status (G7) command with no errors present is "1000".
140 REM
150 CLEAR 59736!
160 IBINIT1 = 59736!
170 IBINIT2 = IBINIT1 + 3 180 BLOAD "bib.m",IBINIT1
190 CALL IBINIT1(IBFIND,IBTRG,IBCLR,IBPCT. AABSIC,IBLOC,IBPPC,IBBNA,IBONL,IBRSC,IBSRE, IBRSV,IBPAD, IBSAD, IBIST,IBDMA,IBEOS,IBTMO, IBEOT, IBRDF,IBWRTF)
200 CALL IBINIT2(1BGTS,IBCAC,IBWAIT,IBPOKE,IBWRT. IBRPP,IBRSP,IBDIAG, IBXTRC,IBRDI,IBWRTI,IBRDIA.IB
210 REM 220 REM 230 REM 240 DEVNAME="18840A"
250 CALL IBFIND (DEVNAME$,DVM%)
260 CALL IBCLR (DVM%)
270 FOR W = 1 TO 500: NEXT W
280 PRINT "MONITORING SELFTEST"
290 WRT$ = "ZO" : CALL IBWRT (DVM%,WRTS$) 300 WRT$ = "G7" : CALL IBWRT (DVM%,WRTS) 310 E$ = SPACES(6)
320 CALL IBRD (DVM%,E$)
330 IF (LEFT$(E$,4) = "1000") THEN GOTO 360 340 WRTS = "XO" : CALL IBWRT (DVM%,WRTS) 350 PRINT "ERROR *;RIGHT$(ES$,3);" OCCURRED" 360 WRT$ = "GO" : CALL IBWRT (DVM%,WRTS) 370 ST$=SPACE$(6)
380 CALL IBRD (DVM%,ST$)
390 IF LEFT$(ST$,4) >= "9000" THEN GOTO 300 400 WRT$ = "G7" : CALL IBWRT (DVM%,WRTS) 410 E$ = SPACE$(6)
420 CALL IBRD (DVM%,ES)
430 IF (LEFT$(E$,4) = 1000") THEN GOTO 450 440 PRINT "ERROR *;RIGHTS(E$,3);" OCCURRED" 450 PRINT
460 PRINT "SELFTEST COMPLETE"
470 END
,IBWRTA,IBCMD,IBCMDA,IBRD,IBRDA,IBSTOP, WRTIA,IBSTA%,IBERR%,IBCNT%)
IBM BASICA on IBM PC,.PC-XT or PC-AT Lo
"Device name is 18840A
Initialize the DMM
’Clear device
"Wait 1 second before sending commands
"Start selftest
"Read error status
"Check for errors
"Clear error register
Print analog error
"Get instrument configuration
’Check for selftest still active
"Read error status ’Check for errors Print digital error
Figure 3-14. Example Programs: Using the IBM pe” (cont)
3:29
Page 65
Remote. Programming EXAMPLE PROGRAMS
The following application program is written in QBASIC for the IBM PC, PC-XT or
PC-AT. The National Instruments Model GPIB-PCIIA board provides the interface between the PC and the Fluke 8840A DMM. The program assumes that the configuration program IBCONF has been mun to initialize the interface board with the device name 18840A assigned to the GPIBO board.
en?
This program selects VDC (F1), Autorange (RO), Slow rate (SO), Continuous trigger (TO) and suffixes enabled (Y1). The program takes 10 readings, displays them on the screen, and then stops.
, Microsoft QuickBasic V 4.5 on IBM PC, PC-XT or PC-AT
*SINCLUDE: *qbib45.dcl’ devname$ = "I8840A" "Device name is I8840A CALL IBFIND(devname$, dvm%) Initialize the DMM CALL IBCLR(dvm%) Clear device WRT$ = "F1IROSOTOY1" *Set up ‘command string CALL IBWRT(dvm%, WRT$) *Write functions to instrument FOR i = 1T0O 10 RD$ = SPACE$(18) ’11 characters for the reading, 5 for "the suffix, and 2 for terminators CALL IBRD(dvm%, RD$) "Get data PRINT i, LEFT$(RD$, 16) Print to display NEXT i END
Microsoft® is a registered trademark of Microsoft Corporation
QuickBASIC” is a trademark of Microsoft Corporation
Figure 3-14. Example Programs: Using the IBM PC® (cont)
Page 66
Remote P: rammi SAMPLE. PROGRAM vy v_ ve we ey we again:
The following application program is written in QBASIC for the IBM PC, PC-XT or
PC-AT. The National Instruments Model GPIB-PCIIA board provides the interface between the PC and the Fluke 8840A DMM. The program assumes that the configuration program IBCONF has been run to initialize the interface board with the device name I8840A assigned to the GPIBO board.
This program selects VDC (F1), Autorange (RO), Slow rate (SO), Continuous trigger (TO) and suffixes enabled (Y1). All readings appear simultaneously on the instrument display and the PC screen with suffixes enabled for function readout. Full local control is given to the 8840A. Note the local control must be given to the board and not the device. Press <CTRL> BREAK to terminate this program.
Microsoft QuickBasic V 4.5 on IBM PC, PC-XT or PC-AT
*S$INCLUDE: ’qbib45.del’
BDNAME$ = "GPIBO" : ' "Board name is GPIBO
CALL IBFIND(BDNAME$, BD%) "Initialize IEEE Interface Board devname$ = "18840A" "Device name is I8840A.
CALL IBFIND(devname$, dvm%) "Initialize the device
CALL IBCLR(dvm%) *Clear the device
WRT$ = "FIROSOTOY1" "F1 = Volts DC, RO = Autorange,
°SO = Slow reading rate, TO = Internal me os Trigger, Y1 = Enable suffix: CALL IBWRT(dvm%, WRT$) ’ -" *Write functions to the instrument
CALL IBLOC(dvm%) ’Give local control to the instrument V% = 0: x% = O CALL IBSRE(BD%, V%) : "De-assert the remote enable (REN) signal so *the-8840A stays in local when an IBRD call» *is made RD$ = SPACE$(18) "11 characters for the reading, 5 for the ; . ’suffix and 2 for the terminators CALL IBRD(dvm%, RD$) Get data x% = x%+1 Increment reading count PRINT x%, LEFT$(RD$, 16) ‘Display reading GOTO again END
Figure 3-14. Example Programs: Using the IBM pc® (cont) . a 3-
31
Page 67
Remote Programming EXAMPLE PROGRAMS
~ we we ew vy ew & ww label1:
The following application program is written in QBASIC for the IBM PC, PC-XT or
PC-AT. The National Instruments Model GPIB-PCIIA board provides the interface between the PC and the Fluke 8840A DMM. The program assumes that the configuration program IBCONF has been run to initialize the interface board with the device name 18840A assigned to the GPIBO board.
This program illustrates one possible use of the serial poll register. In this case it is merely looking for data available. The function of the program isto _ display on the screen the lowest resistance value measured on the input terminals of the 8840A using the 2-wire ohms function in autorange. The range and function commands are programmed using the Put Instrument Configuration (PO) command. Microsoft QuickBasic V 4.5 on IBM PC, PC-XT or PC-AT
*SINCLUDE: ’qbib45.dcl’ bdname$ = "GPIBO" "Board name is GPIBO
CALL IBFIND(bdname$, BD%) ‘Initialize the Interface Board devname$ = "18840A" "Device name is I8840A CALL IBFIND(devname$, dvm%) ‘Initialize the device
CALL IBCLR(dvm%) Clear the device
WRTS$ = "N3001P0 Y1 2" CALL IBWRT(dvm%, WRTS) RD$ = SPACE$(18)
CALL IBRD(dvm%, RD$) Get first reading r = VAL(RD$) :
"Write functions to the instrument
PRINT LEFT$(RD$, 16); "S (2-WIRE) LOWEST READING"
DO Execute the statements up to the loop, ’statement until new low is found WRTS$ = "2" CALL IBWRT(dvm%, WRT$) "Trigger the device SPR% = 0
DO UNTIL SPR% AND &H40 = &H40 CALL IBRSP(dvm%, SPR%) Serial poll the device until data available
LOOP
RD$ = SPACE$(18)
CALL IBRD(dvm%, RD$) "Get next data s = VAL(RD$) LOOP WHILE s >= r "Throw away data if not lowest r=s . "Update lowest reading GOTO label1 "Print new low
END
3-32
Figure 3-14. Exampie Programs: Using the IBM pc® (cont)
Page 68
Remote Programmin EXAMPLS PROSHANS
~~ e~ we ww
Mv we we we
The following application program is written in QBASIC for the IBM PC, PC-XT or
PC-AT. The National Instruments Model GPIB-PCIIA board provides the interface between the PC and the Fluke 8840A DMM. The program assumes that the configuration Program IBCONF has been run to initialize the interface board with the device name I18840A assigned to the GPIBO board.
This program illustrates a method of recording any errors produced by the 8840A selftest function. It should be noted that:
1. If more than one digital error occurs, only the last one will be reported.
2, The response to a Get Instrument Config. (GO) command during selftest is "9xxx". 3. The response to a Get Error Status (G7) command with no errors present is "1000".
Microsoft QuickBasic V 4.5 on IBM PC, PC-XT or PC-AT
*SINCLUDE: ’qbib45.del’
BDNAMES$ = "GPIBO" Board name is GPIBO CALL IBFIND(BDNAMES, BD%) Initialize the interface board devname$ = "I8840A" "Device name is I8840A CALL IBFIND(devname$, dvm%) ‘Initialize the device PRINT "MONITORING SELFTEST" WRT$ = °ZO" CALL IBWRT(dvm%, WRT$) Start selftest DO WRT$ = "G7"
CALL IBWRT(dvm%, WRT$) RD$ = SPACE$(18)
CALL IBRD(dvm%, RD$) ’Get error status errcode$ = LEFT$(RD$§, 4) IF (errcode$ <> "1000") THEN ’Check for errors WRT$ = "XO" "Clear error register CALL IBWRT(dvm%, WRTS) PRINT "Error "; RIGHTS (errcode$, 3); " occurred” END IF
CALL IBWRT(dvm%, "GO") st$ = SPACE$(16) ; CALL IBRD(dvm%, st$) "Get instrument configuration stat$ = LEFT$(st$, 1) LOOP WHILE stat$ = "9" "Loop while selftest still active WRT$ = "G7"
CALL IBWRT(dvm%, WRT$)
RD$ = SPACE$(18)
CALL IBRD(dvm%, RD$) Get error status errcode$ = LEFT$(RD$, 4)
IF (errcode$ <> *1000") THEN Check for errors PRINT "Error"; RIGHTS (errcode$, 3); " occurred"
END IF
PRINT "Selftest Complete"
END
Figure 3-14. Example Programs: Using the IBM pC (cont)
3°33
Page 69
Remote Programming EXAMPLE PROGRAMS
/* The following application program is written in C for the IBM PC-AT. The National Instruments Model AT-GPIB board provides the interface between the PC and the Fluke 8840A DMM. The program assumes that the configuration program IBCONF has been run to initialize the interface board with the device name 18840A assigned to the GPIBO board.
This program selects VDC (F1), Autorange (RO), Slow rate (SO), Continuous trigger (TO) and suffixes enabled (Y1). The program takes 10 readings, displays them on the screen, and then stops. Microsoft C Version 6.0 on IBM PC-AT */
/* Link this program with appropriate mcib*.obj. */ #include <stdio.h> #include “decl.h" char rd[512]; /* read data buffer */ int dmm; /* device number | */ int i; main( )
{ dmm = ibfind('18840A"); /* device name is 18840A */ ibeir(dmm); . /* clear device */ ibwrt(dmm,"F1ROSOTOY1",10); /* write functions to instrument */ for(i=0;i<10;i++) {ibrd(dmm,rd); /* get data */ printf(%d %s",i,rd); /* print to display | */ }
}
3-34 Figure 3-14. Example Programs: Using the IBM po” (cont)
Page 70
Remote Programming EXAMPLE PROGRAMS
/* The following application program is written in C for the IBM PC-AT. The National Instruments Model AT-GPIB board provides the interface between the PC and the Fluke 8840A DMM. The Program assumes that the configuration program IBCONF has been run to initialize the interface board with the device name I8840A assigned to the GPIBO board.
This program selects VDC (F1), Autorange (RO), Slow rate (SO), Continuous trigger (TO)
and suffixes enabled (Y1). All readings appear simultaneously on the instrument display and the PC screen with suffixes enabled for function readout. Full local control is given to the 8840A. Note the local control must be given to the board and not the device. Press <CTRL> C to terminate this program.
Microsoft C Version 6.0 on IBM PC-AT */ /* Link this program with appropriate mcib*.obj. el A
#include <stdio.h> #include “decl.h" char rd{512]; /* read data buffer */ int brdO; /* interface board number */ int dmm; /* device number */ int x; .
main( )
{ | brdO = ibfind("GPIBO"); /* initialize board */ dmm = ibfind("18840A"); /* initialize device */ ibelr(dmm); /* clear device | */ ibwrt(dmm,"F1ROSOTOY1",10) i /* write functions to instrument */ ibloc(dmm); /* local the device */ ibsre(brd0,0); /* de-assert the remote enable (REN) signal so the */ /* 8840A stays in local when an ibrd call is made */ x = 0;
ibrd(dmm,rd); /* get data */
X = x+1; /* increment reading count */ printf("%d © %s",x,rd); /* display readings */ goto in;
}
Figure 3-14. Exampie Programs: Using the IBM Pc® cont) , 3-35