'************************************************************************* '** N7001485.BAS ** '** ** '** Example program using the 485 Picoammeter and the 7001 ** '** Mainframe. The 7001 will scan 10 channels ten times and ** '** the readings in the 485 100-point data buffer. The readings ** '** are returned to the host computer. The example uses the ** '** National Instruments AT-GPIB card and NI-488.2 Driver. ** '** ** '** Author: Jonathan L. Tucker ** '** Date: June 24, 1992 ** '** Copyright (c) Keithley Instruments, Inc. 1992 ** '************************************************************************* '$INCLUDE: 'QBDECL.bas' DIM instruments%(10) ' Instrument addr. space DIM result!(100) ' Allocate data space CLS '*** Initialize interface board CALL SendIFC(0) '*** Declare instrument addresses instruments%(0) = 3 ' 485 Adrress instruments%(1) = 16 ' 7001 Address instruments%(2) = NOADDR ' Null address '*** Reset the 485 and 7001 CALL DevClearList(0, instruments%()) '*** Remote Enable all devices CALL EnableRemote(0, instruments%()) '*** Setup 485 cmd$ = "R0C1G1T3X" ' R0 = Autorange ' C1 = Zero Check On ' T3 = One-Shot on Get ' G1 = No prefix sent ' X = Execute CALL Send(0, instruments%(0), cmd$, NLend) ' Send command '*** Setup 7001 for 10 channels to scan, 10 scans and the 7001 is ' triggered by a Bus trigger to switch to the next channel. cmd$ = ":System:Preset" ' Perform System Reset CALL Send(0, instruments%(1), cmd$, NLend) cmd$ = ":Configure:Slot1:Ctype C7066;Pole 2" ' Set for 7066, 2 pole CALL Send(0, instruments%(1), cmd$, NLend) cmd$ = ":Open All" ' Open all relays CALL Send(0, instruments%(1), cmd$, NLend) cmd$ = ":Arm:Source Immediate" ' Arm layer immediate trig. CALL Send(0, instruments%(1), cmd$, NLend) cmd$ = ":Arm:Layer2:Source Immediate" ' Scan Layer Immediate trig. CALL Send(0, instruments%(1), cmd$, NLend) cmd$ = ":Arm:Layer2:Count 10" ' Set for 10 scans CALL Send(0, instruments%(1), cmd$, NLend) cmd$ = ":Trigger:Source Bus" ' Channel Layer Bus Trigger CALL Send(0, instruments%(1), cmd$, NLend) cmd$ = ":Trigger:Delay 0" ' 0 Millisecond delay CALL Send(0, instruments%(1), cmd$, NLend) cmd$ = ":Scan (@1!1:1!10)" ' Set for 10 channels CALL Send(0, instruments%(1), cmd$, NLend) cmd$ = ":Initiate:Immediate" ' Take 7001 out of idle CALL Send(0, instruments%(1), cmd$, NLend) '*** PRINT "Press to start test..." WHILE INKEY$ = "": WEND '*** Put 485 out of zero check cmd$ = "C0X" CALL Send(0, instruments%(0), cmd$, NLend) '*** Take readings, store in data array called result! readings$ = SPACE$(20) FOR rdgcount% = 1 TO 100 CALL Trigger(0, instruments%(1)) ' Trigger 7001 t! = TIMER: WHILE TIMER - t! < .3: WEND ' 300 Msec delay CALL Trigger(0, instruments%(0)) ' Trigger 485 DO ' Is reading ready? CALL ReadStatusByte(0, instruments%(0), status%) status% = status% AND 8 LOOP WHILE status% = 0 CALL Receive(0, 3, readings$, STOPend) ' Get reading result!(rdgcount%) = VAL(readings$) NEXT rdgcount% '*** Display readings to screen CLS PRINT "Press to print readings..." WHILE INKEY$ = "": WEND FOR rdgcount% = 1 TO 100 PRINT "Reading "; rdgcount%; " = "; result!(rdgcount%) NEXT rdgcount% END