' ' This program configures 2001 / 7001 combo for externaly triggered scan ' into memory. Then binary dump over gpib. The test used the Model 7011-S ' relay card. It is wired with 10 resistors on channels 1!1:1!10. The test ' revealed 16 msec per scan/read. All of the data goes into the 2001 memory ' and then dumped over the bus. The 16 msec is the time for one close/read ' cycle. ' DECLARE SUB Delay (tdelay!) '$INCLUDE: 'C:\CEC\IEEEQB.BI' ' ' Initialize global variables. ' CLS DmmAddr% = 16 ScanAddr% = 7 Rdg$ = SPACE$(200) cmd$ = SPACE$(80) Sme$ = SPACE$(10) ' ' ' Initialize GPIB. ' CALL initialize(21, 0) CALL setoutputEOS(10, 0) CALL setinputEOS(10) CALL settimeout(5000) ' ' Idle 2001 and 7001. ' cmd$ = "*RST;:INIT:CONT OFF" GOSUB send2001 cmd$ = ":ABORT" GOSUB send2001 cmd$ = "*RST;:INIT:CONT OFF" GOSUB send7001 cmd$ = ":ABORT" GOSUB send7001 ' ' Initialize 2001. ' cmd$ = ":SYSTEM:AZERO:STATE on" GOSUB send2001 cmd$ = ":FORMAT:ELEM READ" GOSUB send2001 cmd$ = ":SENSE:FUNC 'RES'" GOSUB send2001 cmd$ = ":SENSE:res:AVER:STATE OFF" GOSUB send2001 cmd$ = ":SENSE:res:NPLC 0.1" GOSUB send2001 cmd$ = ":SENSE:res:RANGE 100" GOSUB send2001 cmd$ = ":ARM:LAYER1:SOURCE IMM" GOSUB send2001 cmd$ = ":ARM:LAYER2:SOURCE BUS" GOSUB send2001 cmd$ = ":TRIG:SOURCE EXT" GOSUB send2001 cmd$ = ":ARM:LAYER1:COUNT 1" GOSUB send2001 cmd$ = ":ARM:LAYER2:COUNT 1" GOSUB send2001 cmd$ = ":TRIG:COUNT 10" GOSUB send2001 cmd$ = ":ARM:LAYER2:DELAY 0" GOSUB send2001 cmd$ = ":TRIG:DELAY 0" GOSUB send2001 cmd$ = ":TRIG:TCON:DIR SOUR" GOSUB send2001 ' ' Initialize 7001. ' cmd$ = ":ROUTE:OPEN ALL" GOSUB send7001 cmd$ = ":ROUTE:SCAN (@1!1:1!10)" GOSUB send7001 cmd$ = ":ARM:LAYER1:SOURCE IMM" GOSUB send7001 cmd$ = ":ARM:LAYER2:SOURCE IMM" GOSUB send7001 cmd$ = ":TRIG:SOURCE EXT" GOSUB send7001 cmd$ = ":ARM:LAYER1:COUNT 1" GOSUB send7001 cmd$ = ":ARM:LAYER2:COUNT 1" GOSUB send7001 cmd$ = ":TRIG:COUNT INF" GOSUB send7001 cmd$ = ":ARM:LAYER2:DELAY 0" GOSUB send7001 cmd$ = ":TRIG:DELAY 0" GOSUB send7001 cmd$ = ":TRIG:TCON:DIR SOUR" GOSUB send7001 ' ' Close first channel in list. ' cmd$ = ":INIT" GOSUB send7001 cmd$ = ":INIT" GOSUB send2001 ' ' Arm buffer. ' cmd$ = "*SRE 1" GOSUB send2001 cmd$ = "STAT:MEAS:PTR 32767;NTR 0;ENAB 512" GOSUB send2001 cmd$ = ":TRAC:FEED CALC" GOSUB send2001 cmd$ = ":TRAC:POIN 10" GOSUB send2001 cmd$ = ":TRAC:EGR COMP" GOSUB send2001 cmd$ = ":FORM:DATA SREAL" GOSUB send2001 cmd$ = ":TRAC:FEED:CONT NEXT;*OPC" GOSUB send2001 CALL Delay(1) ' ' Start filling.... ' t1 = TIMER CALL transmit("UNL LISTEN 16 GET", status%) ' ' Wait for buffer to fill... ' DO DO LOOP UNTIL srq% CALL spoll(DmmAddr%, poll%, status%) LOOP UNTIL (poll% AND 64) cmd$ = ":STAT:MEAS:EVENT?" GOSUB send2001 CALL enter(Sme$, length%, 16, status%) ' ' Go get buffer contents. ' cmd$ = "TRACe:DATA?" GOSUB send2001 DIM Readings!(1 TO 10), dummy!(1 TO 1) ' Setup CEC for LISTEN & 2001 for TALK CALL transmit("UNT UNL MLA TALK 16", status%) ' Read 2 bytes (#0) r$ = SPACE$(2) CALL receive(r$, l%, status%) NumDataPoints% = 10 ' Get Data in 4 blocks since CEC can only handle up to 64kB ' per data transfer. NumBytes% = NumDataPoints% * 4 CALL rarray(Readings!(1), NumBytes%, l%, status%) ' get Terminator Character(s) CALL settimeout(100) CALL rarray(dummy!(1), 1, l%, status%) CALL settimeout(10000) CALL transmit("UNT UNL", status%) ' UNTalk and UNListen all devices t2 = TIMER t3 = t2 - t1 FOR i = 1 TO 10 PRINT "Rdg("; i; ") = "; Readings!(i) NEXT i PRINT PRINT "Total time = "; t3 PRINT t4 = t3 / 10 PRINT "Seconds per channel = "; t4 END send2001: CALL send(DmmAddr%, cmd$, status%) RETURN send7001: CALL send(ScanAddr%, cmd$, status%) RETURN SUB Delay (tdelay) tstart = TIMER DO tstop = TIMER LOOP WHILE tstop - tstart <= tdelay END SUB SUB WaitForBuffer CALL send(DmmAddr%, ":stat:meas:ptr 512", status%) WHILE (TRUE) CALL send(DmmAddr%, ":stat:meas:even?", status%) CALL enter(Rdg$, length%, DmmAddr%, status%) ser = VAL(Rdg$) IF (ser AND 512) = 512 THEN EXIT SUB END IF Delay (1) WEND END SUB