' ' This program configures 2001 / 7001 combo for externaly triggered scan. ' Data is retrieved from 2001 using FETCH? during scan. ' The Model 7011-S relay card is used. It is wired with 10 resistors on ' channels 1!!:1!10. The test performed reveals about 22msec per scan/read/send ' sequence. ' DECLARE SUB Delay (tdelay!) '$INCLUDE: 'C:\CEC\IEEEQB.BI' ' ' Initialize global variables. ' CLS DmmAddr% = 16 ScanAddr% = 7 Rdg$ = SPACE$(20) cmd$ = SPACE$(80) Sme$ = SPACE$(10) DIM Readings!(1 TO 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 off" 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.4" 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$ = ":FORM:DATA ASCII" GOSUB send2001 cmd$ = ":STAT:OPER:ARM:SEQ:EVEN?" GOSUB send2001 CALL enter(Rdg$, length%, 16, status%) cmd$ = ":STAT:OPER:ARM:EVEN?" GOSUB send2001 CALL enter(Rdg$, length%, 16, status%) cmd$ = ":STAT:OPER:EVEN?" GOSUB send2001 CALL enter(Rdg$, length%, 16, status%) cmd$ = ":STAT:OPER:ARM:SEQ:ENAB 4" GOSUB send2001 cmd$ = ":STAT:OPER:ARM:ENAB 2" GOSUB send2001 cmd$ = ":STAT:OPER:ENAB 64" GOSUB send2001 cmd$ = "*SRE 128" GOSUB send2001 cmd$ = ":INIT" GOSUB send7001 cmd$ = ":INIT" GOSUB send2001 DO DO LOOP UNTIL srq% CALL spoll(16, poll%, status%) LOOP UNTIL (poll% AND 64) cmd$ = ":STAT:OPER:ARM:SEQ:EVEN?" GOSUB send2001 CALL enter(Rdg$, length%, 16, status%) cmd$ = ":STAT:OPER:ARM:EVEN?" GOSUB send2001 CALL enter(Rdg$, length%, 16, status%) cmd$ = ":STAT:OPER:EVEN?" GOSUB send2001 CALL enter(Rdg$, length%, 16, status%) ' ' Start filling.... ' t1 = TIMER CALL transmit("UNL LISTEN 16 GET", status%) FOR i = 1 TO 10 cmd$ = "FETC?" GOSUB send2001 CALL enter(Rdg$, length%, 16, status%) PRINT Rdg$ NEXT i t2 = TIMER PRINT "Seconds per channel = "; (t2 - t1) / 10 END send2001: CALL send(16, cmd$, status%) RETURN send7001: CALL send(7, cmd$, status%) RETURN SUB Delay (tdelay) tstart = TIMER DO tstop = TIMER LOOP WHILE tstop - tstart <= tdelay END SUB SUB WaitForBuffer CALL send(16, ":stat:meas:ptr 512", status%) WHILE (TRUE) CALL send(16, ":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