DECLARE SUB dac488do0 (d%) DECLARE SUB dac488do1 (d%) '**************************************************************************** 'Module HP3457 'This module contains I/O subroutines for the HP3457. ' 'The following parameters must be present in param.inc. 'gpibinP%, the GPIB input file number 'gpiboutP%, the GPIB output file number 'hp3457addrP%, the HP3457 GPIB address '**************************************************************************** 'Open the parameter file REM $INCLUDE: 'param.inc' SUB hp3457cf (c%, freq!) '**************************************************************************** 'This routine reads the frequency of the voltage applied to a specified 'channel of the HP3457 DVM. ' 'Input: ' c%, the DVM channel to read ' 'Output: ' freq!, the measured frequency ' 'Inputs from param.inc: ' gpibinP%, GPIB input file number ' gpiboutP%, GPIB output file number ' hp3457addrP%, the HP3457 GPIB address ' 'Zachary Wolf '4/21/94, 8/12/94 '**************************************************************************** 'Get the GPIB I/O file numbers and the HP3457 address from the parameters gpibin% = gpibinP% gpibout% = gpiboutP% hp3457addr% = hp3457addrP% 'Put the address number into a string hp3457addr$ = STR$(hp3457addr%) 'Set the GPIB terminators PRINT #gpibout%, "TERM IN CR LF" PRINT #gpibout%, "TERM OUT CR LF EOI" 'Preset the HP3457 PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";PRESET" 'Set the input source to rear terminal PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";TERM REAR" 'Set the channel to read PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";CHAN " + STR$(c%) 'Set the AC bandwidth to the slow mode PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";ACBAND 399" 'Set the frequency source PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";FSOURCE ACV" 'Set up the meter to measure frequency PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";FREQ AUTO" 'Trigger the reading PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";TRIG SGL" 'Get the reading PRINT #gpibout%, "ENTER " + hp3457addr$ INPUT #gpibin%, freq! END SUB SUB hp3457cmon (c%) '**************************************************************************** 'This routine displays the voltage applied to a specified channel of the 'HP3457 DVM on the front panel. Voltages can be monitored while the 'program is running. ' 'Input: c%, the DVM channel to read and display ' 'Inputs from param.inc: ' gpibinP%, GPIB input file number ' gpiboutP%, GPIB output file number ' hp3457addrP%, the HP3457 GPIB address ' 'Zachary Wolf '5/23/94 '**************************************************************************** 'Get the GPIB I/O file numbers and the HP3457 address from the parameters gpibin% = gpibinP% gpibout% = gpiboutP% hp3457addr% = hp3457addrP% 'Put the address number into a string hp3457addr$ = STR$(hp3457addr%) 'Set the GPIB terminators PRINT #gpibout%, "TERM IN CR LF" PRINT #gpibout%, "TERM OUT CR LF EOI" 'Preset the HP3457 PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";PRESET" 'Set the input source to rear terminal PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";TERM REAR" 'Set the channel to read PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";CHAN " + STR$(c%) 'Set the A/D integration time PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";NPLC 10" 'Trigger the reading PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";TRIG AUTO" END SUB SUB hp3457cntv (c%, n%, t!, v!()) '**************************************************************************** 'This subroutine takes n voltage readings spaced t seconds apart and returns 'the values. ' 'Input: ' c%, the DVM channel to read ' n%, the number of voltage samples ' t!, the time between voltage samples ' 'Output: ' v!(0 to n%-1), the measured voltages ' 'Inputs from param.inc: ' gpibinP%, GPIB input file number ' gpiboutP%, GPIB output file number ' hp3457addrP%, the HP3457 GPIB address ' 'Zachary Wolf '4/21/94 '**************************************************************************** 'Get the GPIB I/O file numbers and the HP3457 address from the parameters gpibin% = gpibinP% gpibout% = gpiboutP% hp3457addr% = hp3457addrP% 'Put the address number into a string hp3457addr$ = STR$(hp3457addr%) 'Set the GPIB terminators PRINT #gpibout%, "TERM IN CR LF" PRINT #gpibout%, "TERM OUT CR LF EOI" 'Preset the HP3457 PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";PRESET" 'Set the input source to rear terminal PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";TERM REAR" 'Set the channel PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";CHAN " + STR$(c%) 'Set the voltage range PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";DCV 3" 'Set the A/D integration time PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";NPLC .1" 'Turn off the autozero PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";AZERO OFF" 'Turn off the display PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";DISP OFF" 'Set the timer PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";TIMER " + STR$(t!) 'Send the readings to the memory PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";MSIZE " + STR$(n% * 4 + 10) PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";MEM FIFO" 'Trigger the reading PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";TARM AUTO" PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";NRDGS " + STR$(n%) + ", TIMER" PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";TRIG SGL" 'Get the readings FOR i% = 0 TO n% - 1 PRINT #gpibout%, "ENTER " + hp3457addr$ INPUT #gpibin%, v!(i%) NEXT i% END SUB SUB hp3457cnvtrig (c%, n%, v!()) '**************************************************************************** 'This subroutine takes n triggered voltage readings and returns the values. 'It uses the DAC488 to control the encoder interface which sends 'trigger pulses. ' 'Input: ' c%, the DVM channel to read ' n%, the number of voltage samples ' 'Output: ' v!(0 to n%-1), the measured voltages ' 'Inputs from param.inc: ' gpibinP%, GPIB input file number ' gpiboutP%, GPIB output file number ' hp3457addrP%, the HP3457 GPIB address ' 'Zachary Wolf '4/21/94 '**************************************************************************** 'Get the GPIB I/O file numbers and the HP3457 address from the parameters gpibin% = gpibinP% gpibout% = gpiboutP% hp3457addr% = hp3457addrP% 'Put the address number into a string hp3457addr$ = STR$(hp3457addr%) 'Set the GPIB terminators PRINT #gpibout%, "TERM IN CR LF" PRINT #gpibout%, "TERM OUT CR LF EOI" 'Preset the HP3457 PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";PRESET" 'Clear the encoder interface to stop trigger pulses from reaching the DVM CALL dac488do1(1) 'Set the GPIB terminators after a call to another hardware device PRINT #gpibout%, "TERM IN CR LF" PRINT #gpibout%, "TERM OUT CR LF EOI" 'Set the input source to rear terminal PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";TERM REAR" 'Set the channel PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";CHAN " + STR$(c%) 'Set the voltage range PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";DCV 30" 'Set the A/D integration time PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";NPLC .0005" 'Turn off the autozero PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";AZERO OFF" 'Turn off the display PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";DISP OFF" 'Turn on the keyboard lock PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";LOCK ON" 'Turn off the delay PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";DELAY 0" 'Send the readings to the memory PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";MSIZE " + STR$(n% * 4 + 10) PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";MEM FIFO" PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";MFORMAT SINT" 'Turn on the input buffer so the line is not held PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";INBUF ON" 'Set up the trigger PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";TARM AUTO" PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";NRDGS " + STR$(n%) + ", EXT" PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";TRIG SGL" 'Wait until the set up is complete SLEEP 1 'Signal the encoder interface to allow trigger pulses to the DVM CALL dac488do0(1) 'Set the GPIB terminators after a call to another hardware device PRINT #gpibout%, "TERM IN CR LF" PRINT #gpibout%, "TERM OUT CR LF EOI" 'Wait until the readings are complete spoll% = 0 WHILE NOT spoll% AND 16 PRINT #gpibout%, "SPOLL " + hp3457addr$ INPUT #gpibin%, spoll% ' PRINT spoll% WEND 'Turn off the input buffer PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";INBUF OFF" 'Get the readings FOR i% = 0 TO n% - 1 PRINT #gpibout%, "ENTER " + hp3457addr$ INPUT #gpibin%, v!(i%) NEXT i% 'Reset the encoder interface CALL dac488do1(1) 'Remember to set the terminators if any more code is added END SUB SUB hp3457cr (c%, r!) '**************************************************************************** 'This routine reads the resistance connected to a specified channel of the 'HP3457 DVM. ' 'Input: ' c%, the DVM channel to read ' 'Output: ' r!, the measured resistance ' 'Inputs from param.inc: ' gpibinP%, GPIB input file number ' gpiboutP%, GPIB output file number ' hp3457addrP%, the HP3457 GPIB address ' 'Zachary Wolf '6/8/94 '**************************************************************************** 'Get the GPIB I/O file numbers and the HP3457 address from the parameters gpibin% = gpibinP% gpibout% = gpiboutP% hp3457addr% = hp3457addrP% 'Put the address number into a string hp3457addr$ = STR$(hp3457addr%) 'Set the GPIB terminators PRINT #gpibout%, "TERM IN CR LF" PRINT #gpibout%, "TERM OUT CR LF EOI" 'Preset the HP3457 PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";PRESET" 'Set the input source to rear terminal PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";TERM REAR" 'Set the channel to read PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";CHAN " + STR$(c%) 'Set the number of power line cycles to reject noise (affects resolution) PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";NPLC 10" 'Set the function to measure resistance, autorange, % resolution PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";FUNC OHM, AUTO, .01" 'Trigger the reading PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";TRIG SGL" 'Get the reading PRINT #gpibout%, "ENTER " + hp3457addr$ INPUT #gpibin%, r! 'Put the DVM back in a high impedance state PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";PRESET" END SUB SUB hp3457ctc (c%, tc!) '**************************************************************************** 'This routine reads the temperature from a thermistor connected to a 'specified channel of the HP3457 DVM. ' 'Input: ' c%, the DVM channel to read ' 'Output: ' tc!, the measured temperature in degrees Celsius ' 'Inputs from param.inc: ' gpibinP%, GPIB input file number ' gpiboutP%, GPIB output file number ' hp3457addrP%, the HP3457 GPIB address ' 'Zachary Wolf '6/10/94 '**************************************************************************** 'Get the GPIB I/O file numbers and the HP3457 address from the parameters gpibin% = gpibinP% gpibout% = gpiboutP% hp3457addr% = hp3457addrP% 'Put the address number into a string hp3457addr$ = STR$(hp3457addr%) 'Set the GPIB terminators PRINT #gpibout%, "TERM IN CR LF" PRINT #gpibout%, "TERM OUT CR LF EOI" 'Preset the HP3457 PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";PRESET" 'Set the input source to rear terminal PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";TERM REAR" 'Set the channel to read PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";CHAN " + STR$(c%) 'Set the number of power line cycles to reject noise (affects resolution) PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";NPLC 10" 'Set the function to measure resistance, autorange, % resolution PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";FUNC OHM, AUTO, .01" 'Set up the math function to convert resistance to temperature PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";MATH CTHRM" 'Trigger the reading PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";TRIG SGL" 'Get the reading PRINT #gpibout%, "ENTER " + hp3457addr$ INPUT #gpibin%, tc! 'Put the DVM back in a high impedance state PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";PRESET" END SUB SUB hp3457ctf (c%, tf!) '**************************************************************************** 'This routine reads the temperature from a thermistor connected to a 'specified channel of the HP3457 DVM. ' 'Input: ' c%, the DVM channel to read ' 'Output: ' tf!, the measured temperature in degrees Fahrenheit ' 'Inputs from param.inc: ' gpibinP%, GPIB input file number ' gpiboutP%, GPIB output file number ' hp3457addrP%, the HP3457 GPIB address ' 'Zachary Wolf '6/10/94 '**************************************************************************** 'Get the GPIB I/O file numbers and the HP3457 address from the parameters gpibin% = gpibinP% gpibout% = gpiboutP% hp3457addr% = hp3457addrP% 'Put the address number into a string hp3457addr$ = STR$(hp3457addr%) 'Set the GPIB terminators PRINT #gpibout%, "TERM IN CR LF" PRINT #gpibout%, "TERM OUT CR LF EOI" 'Preset the HP3457 PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";PRESET" 'Set the input source to rear terminal PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";TERM REAR" 'Set the channel to read PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";CHAN " + STR$(c%) 'Set the number of power line cycles to reject noise (affects resolution) PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";NPLC 10" 'Set the function to measure resistance, autorange, % resolution PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";FUNC OHM, AUTO, .01" 'Set up the math function to convert resistance to temperature PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";MATH FTHRM" 'Trigger the reading PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";TRIG SGL" 'Get the reading PRINT #gpibout%, "ENTER " + hp3457addr$ INPUT #gpibin%, tf! 'Put the DVM back in a high impedance state PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";PRESET" END SUB SUB hp3457cv (c%, v!) '**************************************************************************** 'This routine reads the voltage applied to a specified channel of the 'HP3457 DVM. ' 'Input: ' c%, the DVM channel to read ' 'Output: ' v!, the measured voltage ' 'Inputs from param.inc: ' gpibinP%, GPIB input file number ' gpiboutP%, GPIB output file number ' hp3457addrP%, the HP3457 GPIB address ' 'Zachary Wolf '4/21/94 '**************************************************************************** 'Get the GPIB I/O file numbers and the HP3457 address from the parameters gpibin% = gpibinP% gpibout% = gpiboutP% hp3457addr% = hp3457addrP% 'Put the address number into a string hp3457addr$ = STR$(hp3457addr%) 'Set the GPIB terminators PRINT #gpibout%, "TERM IN CR LF" PRINT #gpibout%, "TERM OUT CR LF EOI" 'Preset the HP3457 PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";PRESET" 'Set the input source to rear terminal PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";TERM REAR" 'Set the channel to read PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";CHAN " + STR$(c%) 'Set the A/D integration time PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";NPLC 10" 'Trigger the reading PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";TRIG SGL" 'Get the reading PRINT #gpibout%, "ENTER " + hp3457addr$ INPUT #gpibin%, v! END SUB SUB hp3457cvnoise (c%, v!) '**************************************************************************** 'This routine reads the voltage applied to a specified channel of the 'HP3457 DVM. It uses a long integration time to reduce noise. ' 'Input: c%, the DVM channel to read ' 'Output: v!, the measured voltage ' 'Inputs from param.inc: ' gpibinP%, GPIB input file number ' gpiboutP%, GPIB output file number ' hp3457addrP%, the HP3457 GPIB address ' 'Zachary Wolf '4/21/94 '**************************************************************************** 'Get the GPIB I/O file numbers and the HP3457 address from the parameters gpibin% = gpibinP% gpibout% = gpiboutP% hp3457addr% = hp3457addrP% 'Put the address number into a string hp3457addr$ = STR$(hp3457addr%) 'Set the GPIB terminators PRINT #gpibout%, "TERM IN CR LF" PRINT #gpibout%, "TERM OUT CR LF EOI" 'Preset the HP3457 PRINT #gpibout%, "OUTPUT " + hp3457addr$ + "; PRESET" 'Set the input source to rear terminal PRINT #gpibout%, "OUTPUT " + hp3457addr$ + "; TERM REAR" 'Set the channel to read PRINT #gpibout%, "OUTPUT " + hp3457addr$ + "; CHAN " + STR$(c%) 'Set the A/D integration time PRINT #gpibout%, "OUTPUT " + hp3457addr$ + "; NPLC 100" 'Turn off autozero to reduce the time of the reading PRINT #gpibout%, "OUTPUT " + hp3457addr$ + "; AZERO OFF" 'Trigger the reading PRINT #gpibout%, "OUTPUT " + hp3457addr$ + "; TRIG SGL" 'Get the reading PRINT #gpibout%, "ENTER " + hp3457addr$ INPUT #gpibin%, v! END SUB SUB hp3457err '**************************************************************************** 'This subroutine asks the HP3457 about any errors and prints the result. ' 'Inputs from param.inc: ' gpibinP%, GPIB input file number ' gpiboutP%, GPIB output file number ' hp3457addrP%, the HP3457 GPIB address ' 'Zachary Wolf '8/14/94 '**************************************************************************** 'Get the GPIB I/O file numbers and the HP3457 address from the parameters gpibin% = gpibinP% gpibout% = gpiboutP% hp3457addr% = hp3457addrP% 'Put the address number into a string hp3457addr$ = STR$(hp3457addr%) 'Set the GPIB terminators PRINT #gpibout%, "TERM IN CR LF" PRINT #gpibout%, "TERM OUT CR LF EOI" 'Any errors? PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";ERR?" PRINT #gpibout%, "ENTER " + hp3457addr$ INPUT #gpibin%, a% PRINT "HP3457, ERR = "; a% END SUB SUB hp3457getcntv (n%, v!()) '**************************************************************************** 'This subroutine collects the values from n voltage readings 'spaced t seconds apart. ' 'Input: ' n%, the number of voltage samples ' 'Output: ' v!(0 to n%-1), the measured voltages ' 'Inputs from param.inc: ' gpibinP%, GPIB input file number ' gpiboutP%, GPIB output file number ' hp3457addrP%, the HP3457 GPIB address ' 'Zachary Wolf '2/15/95 '**************************************************************************** 'Get the GPIB I/O file numbers and the HP3457 address from the parameters gpibin% = gpibinP% gpibout% = gpiboutP% hp3457addr% = hp3457addrP% 'Put the address number into a string hp3457addr$ = STR$(hp3457addr%) 'Set the GPIB terminators PRINT #gpibout%, "TERM IN CR LF" PRINT #gpibout%, "TERM OUT CR LF EOI" 'Make sure the meter is ready for instructions bit4% = 0 WHILE bit4% = 0 SLEEP 1 PRINT #gpibout%, "SPOLL " + hp3457addr$ INPUT #gpibin%, status% bit4% = INT(status% / 16) MOD 2 ' PRINT status%, bit4% WEND 'Turn off the input buffer PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";INBUF OFF" 'Check for errors PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";ERR?" PRINT #gpibout%, "ENTER " + hp3457addr$ INPUT #gpibin%, er% 'PRINT "err? = "; er% IF er% <> 0 THEN PRINT : PRINT "HP3457, ERR = "; er% PRINT "HP3457 Problem, Re-run program!!!" EXIT SUB END IF 'Get the readings FOR i% = 0 TO n% - 1 PRINT #gpibout%, "ENTER " + hp3457addr$ INPUT #gpibin%, v!(i%) NEXT i% END SUB SUB hp3457init '**************************************************************************** 'This subroutine initializes the HP3457. ' 'Inputs from param.inc: ' gpibinP%, GPIB input file number ' gpiboutP%, GPIB output file number ' hp3457addrP%, the HP3457 GPIB address ' 'Zachary Wolf '4/19/94 '**************************************************************************** 'Get the GPIB I/O file numbers and the HP3457 address from the parameters gpibin% = gpibinP% gpibout% = gpiboutP% hp3457addr% = hp3457addrP% 'Put the address number into a string hp3457addr$ = STR$(hp3457addr%) 'Set the GPIB terminators PRINT #gpibout%, "TERM IN CR LF" PRINT #gpibout%, "TERM OUT CR LF EOI" 'Message PRINT PRINT "Resetting the HP3457..." 'Clear the HP3457 PRINT #gpibout%, "CLEAR " + hp3457addr$ 'Preset PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";PRESET" 'Display the ID PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";ID?" PRINT #gpibout%, "ENTER " + hp3457addr$ LINE INPUT #gpibin%, id$ PRINT id$ END SUB SUB hp3457startcntv (c%, n%, t!) '**************************************************************************** 'This subroutine takes n voltage readings spaced t seconds apart. ' 'Input: ' c%, the DVM channel to read ' n%, the number of voltage samples ' t!, the time between voltage samples ' 'Inputs from param.inc: ' gpibinP%, GPIB input file number ' gpiboutP%, GPIB output file number ' hp3457addrP%, the HP3457 GPIB address ' 'Zachary Wolf '2/15/95 '**************************************************************************** 'Get the GPIB I/O file numbers and the HP3457 address from the parameters gpibin% = gpibinP% gpibout% = gpiboutP% hp3457addr% = hp3457addrP% 'Put the address number into a string hp3457addr$ = STR$(hp3457addr%) 'Set the GPIB terminators PRINT #gpibout%, "TERM IN CR LF" PRINT #gpibout%, "TERM OUT CR LF EOI" 'Preset the HP3457 PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";PRESET" 'Turn off the display PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";DISP OFF" 'Lock the display PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";LOCK ON" 'Set the input source to rear terminal PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";TERM REAR" 'Set the channel PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";CHAN " + STR$(c%) 'Set the voltage range PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";DCV .02" 'Set the A/D integration time PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";NPLC .1" 'Turn off the autozero PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";AZERO OFF" 'Set the delay to less than the time before the stage moves PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";DELAY .1" 'Send the readings to the memory PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";MSIZE " + STR$(n% * 4 + 32) PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";MEM FIFO" PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";MFORMAT SREAL" 'Set the timer PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";TIMER " + STR$(t!) 'Set up the trigger PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";TARM AUTO" PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";NRDGS " + STR$(n%) + ", TIMER" 'Turn on the input buffer PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";INBUF ON" 'Trigger the readings PRINT #gpibout%, "OUTPUT " + hp3457addr$ + ";TRIG SGL" END SUB