'************************************************************************* '** TEMP7014.BAS ** '** ** '** Example program using the 7002/2001/7014 Thermocouple Card ** '** ** '** Author: Jonathan L. Tucker ** '** Date: February 23, 1993 ** '** Copyright (c) Keithley Instruments, Inc. 1932 ** '************************************************************************* '$INCLUDE: 'IEEEQB.BI' ' Initialize global variables. CLS DmmAddr% = 16 ScanAddr% = 7 Rdg$ = SPACE$(200) cmd$ = SPACE$(80) sme$ = SPACE$(50) ' Initialize GPIB. CALL initialize(21, 0) CALL setoutputEOS(10, 0) CALL setinputEOS(10) CALL settimeout(5000) cmd$ = "*cls": GOSUB send2001 cmd$ = "*cls": GOSUB send7002 ' Idle 2001 and 7002. cmd$ = "*RST;:Init:Cont Off;:Abort": GOSUB send2001 cmd$ = "*RST;:Init:Cont Off;:Abort": GOSUB send7002 cmd$ = ":Open All": GOSUB send7002 ' Initialize 2001 for temperature cmd$ = ":System:Azero:State On": GOSUB send2001 cmd$ = ":Format:Elem Read": GOSUB send2001 cmd$ = ":Sense:Func 'Temp'": GOSUB send2001 cmd$ = ":Sense:Temp:Aver:State Off": GOSUB send2001 cmd$ = ":Sense:Temp:NPLC 1": GOSUB send2001 cmd$ = ":Route:Scan:Ext:Func (@1),'Rjun1'": GOSUB send2001 cmd$ = ":Route:Scan:Ext:Func (@2:6),'temp'": GOSUB send2001 cmd$ = ":Route:Scan:Ext (@1:6)": GOSUB send2001 'Set up TC parameters cmd$ = ":Temp:Tran TC": GOSUB send2001 cmd$ = ":Temp:TC:Type K": GOSUB send2001 cmd$ = ":Temp:Rjun1:Rsel Real": GOSUB send2001 cmd$ = ":Temp:Rjun1:Real:Offset 0.05463": GOSUB send2001 cmd$ = ":Temp:Rjun1:Real:TCO .0002": GOSUB send2001 ' Set up 2001 triggering parameters cmd$ = ":Arm:Lay1:Sour Imm": GOSUB send2001 cmd$ = ":Arm:Lay2:Sour Imm": GOSUB send2001 cmd$ = ":Trig:Sour Tlink": GOSUB send2001 cmd$ = ":Trig:Tcon:Asyn:ILIN 2;OLIN 1": GOSUB send2001 cmd$ = ":Trig:Tcon:Dir Acc": GOSUB send2001 cmd$ = ":Trig:Count inf": GOSUB send2001 cmd$ = ":Arm:Lay2:Delay 0": GOSUB send2001 cmd$ = ":Trig:Delay 0f": GOSUB send2001 ' Set up Scan Channels in 7002 cmd$ = ":Route:Open ALL": GOSUB send7002 cmd$ = ":Route:Scan (@2!1:2!6)": GOSUB send7002 ' Set up 7002 triggering parameters cmd$ = ":Arm:Lay1:Sour Bus": GOSUB send7002 cmd$ = ":Arm:Lay1:Count Inf": GOSUB send7002 cmd$ = ":Arm:Lay1:Tcon:Dir Acc": GOSUB send7002 cmd$ = ":Arm:Lay2:Sour Imm": GOSUB send7002 cmd$ = ":Trig:Sour Tlink": GOSUB send7002 cmd$ = ":Trig:Tcon:Asyn:ILIN 1;OLIN 2": GOSUB send7002 cmd$ = ":Trig:Seq1:Tcon:Prot Asyn": GOSUB send7002 cmd$ = ":Trig:Count Inf": GOSUB send7002 cmd$ = ":Arm:Lay2:Delay 0": GOSUB send7002 cmd$ = ":Trig:Delay 0": GOSUB send7002 cmd$ = ":Trig:Tcon:Dir Sour": GOSUB send7002 ' Arm buffer. Use as needed. cmd$ = "*SRE 1": GOSUB send2001 cmd$ = ":Stat:Meas:PTR 32767;NTR 0;Enable 512": GOSUB send2001 cmd$ = ":Trace:Feed Calc": GOSUB send2001 cmd$ = ":Trace:Points 90": GOSUB send2001 cmd$ = ":Trace:Egroup Full": GOSUB send2001 cmd$ = ":Format:Data Sreal": GOSUB send2001 cmd$ = ":Trace:Feed:Control Next;*OPC": GOSUB send2001 cmd$ = ":Route:Scan:Lselect Ext": GOSUB send2001 ' Arm 2001 and 7002 and run cmd$ = ":INIT:continuous On": GOSUB send7002: GOSUB send2001 SLEEP 1 PRINT "Test in progress...." CALL transmit("UNT UNL LISTEN 07 GET", status%) WHILE (NOT (srq)): WEND cmd$ = ":Init:Cont Off;:Abort": GOSUB send2001 cmd$ = ":Init:Cont Off;:Abort": GOSUB send7002 cmd$ = ":Open All": GOSUB send7002 BEEP ' Go get buffer contents. cmd$ = "TRACe:DATA?": GOSUB send2001 DIM Readings!(1 TO 350), 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% = 90 ' 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 FOR i% = 0 TO (NumDataPoints% / 6) - 1 FOR cnt% = 1 TO 6 index% = i% * 6 + cnt% PRINT "Rdg("; index%; ") = "; Readings!(index%); " Deg C" NEXT cnt% PRINT "Press to continue. " WHILE INKEY$ = "": WEND NEXT i% END send2001: CALL send(DmmAddr%, cmd$, status%) RETURN send7002: CALL send(ScanAddr%, cmd$, status%) RETURN