'**************************************************************************** 'Module HP3458 'This module contains I/O subroutines for the HP3458. ' 'The following parameters must be present in param.inc. 'gpibinP%, the GPIB input file number 'gpiboutP%, the GPIB output file number 'hp3458addrP%, the HP3458 GPIB address '**************************************************************************** 'Open the parameter file REM $INCLUDE: 'param.inc' SUB hp3458getntv (n%, v!()) '**************************************************************************** 'This returns 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 ' hp3458addrP%, the HP3458 GPIB address ' 'Zachary Wolf '2/3/95 '**************************************************************************** 'Get the GPIB I/O file numbers and the HP3458 address from the parameters gpibin% = gpibinP% gpibout% = gpiboutP% hp3458addr% = hp3458addrP% 'Put the address number into a string hp3458addr$ = STR$(hp3458addr%) '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 " + hp3458addr$ INPUT #gpibin%, status% bit4% = INT(status% / 16) MOD 2 ' PRINT status%, bit4% WEND 'Turn off the input buffer PRINT #gpibout%, "OUTPUT " + hp3458addr$ + ";INBUF OFF" 'Check for errors PRINT #gpibout%, "OUTPUT " + hp3458addr$ + ";ERR?" PRINT #gpibout%, "ENTER " + hp3458addr$ INPUT #gpibin%, er% 'PRINT "err? = "; er% IF er% <> 0 THEN PRINT : PRINT "HP3458, ERR = "; er% PRINT "HP3458 Problem, Re-run program!!!" EXIT SUB END IF 'Get the readings FOR i% = 0 TO n% - 1 PRINT #gpibout%, "ENTER " + hp3458addr$ INPUT #gpibin%, v!(i%) NEXT i% END SUB SUB hp3458init '**************************************************************************** 'This subroutine resets the HP3458. It then does some simple checks. ' 'Zachary Wolf '2/22/94, 2/2/95 '**************************************************************************** 'Get the GPIB I/O file numbers and the HP3458 address from the parameters gpibin% = gpibinP% gpibout% = gpiboutP% hp3458addr% = hp3458addrP% 'Put the address number into a string hp3458addr$ = STR$(hp3458addr%) 'Set the GPIB terminators PRINT #gpibout%, "TERM IN CR LF" PRINT #gpibout%, "TERM OUT CR LF EOI" 'Message PRINT PRINT "Resetting the hp3458..." 'Clear the hp3458 PRINT #gpibout%, "CLEAR " + hp3458addr$ 'Preset PRINT #gpibout%, "OUTPUT " + hp3458addr$ + ";PRESET NORM" 'Display the ID PRINT #gpibout%, "OUTPUT " + hp3458addr$ + ";ID?" PRINT #gpibout%, "ENTER " + hp3458addr$ LINE INPUT #gpibin%, id$ PRINT id$ END SUB SUB hp3458ntv (n%, t!, v!()) '**************************************************************************** 'This subroutine takes n voltage readings spaced t seconds apart and returns 'the values. ' 'Input: ' 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 ' hp3458addrP%, the HP3458 GPIB address ' 'Zachary Wolf '2/3/95 '**************************************************************************** 'Get the GPIB I/O file numbers and the HP3458 address from the parameters gpibin% = gpibinP% gpibout% = gpiboutP% hp3458addr% = hp3458addrP% 'Put the address number into a string hp3458addr$ = STR$(hp3458addr%) 'Set the GPIB terminators PRINT #gpibout%, "TERM IN CR LF" PRINT #gpibout%, "TERM OUT CR LF EOI" 'Preset the HP3458 PRINT #gpibout%, "OUTPUT " + hp3458addr$ + ";PRESET" 'Measure DC Volts PRINT #gpibout%, "OUTPUT " + hp3458addr$ + ";FUNC DCV" 'Set the voltage range PRINT #gpibout%, "OUTPUT " + hp3458addr$ + ";RANGE 10." 'Set the A/D integration time PRINT #gpibout%, "OUTPUT " + hp3458addr$ + ";NPLC 1" 'Turn off the autozero PRINT #gpibout%, "OUTPUT " + hp3458addr$ + ";AZERO OFF" 'Turn off the display PRINT #gpibout%, "OUTPUT " + hp3458addr$ + ";DISP OFF" 'Set the timer PRINT #gpibout%, "OUTPUT " + hp3458addr$ + ";TIMER " + STR$(t!) 'PRINT "t = "; t! 'Send the readings to the memory PRINT #gpibout%, "OUTPUT " + hp3458addr$ + ";MEM FIFO" 'Set up the trigger PRINT #gpibout%, "OUTPUT " + hp3458addr$ + ";TARM AUTO" PRINT #gpibout%, "OUTPUT " + hp3458addr$ + ";NRDGS " + STR$(n%) + ", TIMER" 'Turn on the input buffer PRINT #gpibout%, "OUTPUT " + hp3458addr$ + ";INBUF ON" 'Trigger the readings PRINT #gpibout%, "OUTPUT " + hp3458addr$ + ";TRIG SGL" 'Make sure the meter is ready for instructions bit4% = 0 WHILE bit4% = 0 SLEEP 1 PRINT #gpibout%, "SPOLL " + hp3458addr$ INPUT #gpibin%, status% bit4% = INT(status% / 16) MOD 2 ' PRINT status%, bit4% WEND 'Turn off the input buffer PRINT #gpibout%, "OUTPUT " + hp3458addr$ + ";INBUF OFF" 'Check for errors PRINT #gpibout%, "OUTPUT " + hp3458addr$ + ";ERR?" PRINT #gpibout%, "ENTER " + hp3458addr$ INPUT #gpibin%, er% 'PRINT "err? = "; er% IF er% <> 0 THEN PRINT : PRINT "HP3458, ERR = "; er% PRINT "HP3458 Problem, Re-run program!!!" EXIT SUB END IF 'Get the readings FOR i% = 0 TO n% - 1 PRINT #gpibout%, "ENTER " + hp3458addr$ INPUT #gpibin%, v!(i%) NEXT i% END SUB SUB hp3458startntv (n%, t!) '**************************************************************************** 'This subroutine takes n voltage readings spaced t seconds apart. ' 'Input: ' 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 ' hp3458addrP%, the HP3458 GPIB address ' 'Zachary Wolf '2/3/95 '**************************************************************************** 'Get the GPIB I/O file numbers and the HP3458 address from the parameters gpibin% = gpibinP% gpibout% = gpiboutP% hp3458addr% = hp3458addrP% 'Put the address number into a string hp3458addr$ = STR$(hp3458addr%) 'Set the GPIB terminators PRINT #gpibout%, "TERM IN CR LF" PRINT #gpibout%, "TERM OUT CR LF EOI" 'Preset the HP3458 PRINT #gpibout%, "OUTPUT " + hp3458addr$ + ";PRESET" 'Measure DC Volts PRINT #gpibout%, "OUTPUT " + hp3458addr$ + ";FUNC DCV" 'Set the voltage range PRINT #gpibout%, "OUTPUT " + hp3458addr$ + ";RANGE .1" 'Set the A/D integration time PRINT #gpibout%, "OUTPUT " + hp3458addr$ + ";NPLC 1" 'Turn off the autozero PRINT #gpibout%, "OUTPUT " + hp3458addr$ + ";AZERO OFF" 'Turn off the display PRINT #gpibout%, "OUTPUT " + hp3458addr$ + ";DISP OFF" 'Set the delay value PRINT #gpibout%, "OUTPUT " + hp3458addr$ + ";DELAY .1" 'Set the timer PRINT #gpibout%, "OUTPUT " + hp3458addr$ + ";TIMER " + STR$(t!) 'Send the readings to the memory PRINT #gpibout%, "OUTPUT " + hp3458addr$ + ";MEM FIFO" 'Set up the trigger PRINT #gpibout%, "OUTPUT " + hp3458addr$ + ";TARM AUTO" PRINT #gpibout%, "OUTPUT " + hp3458addr$ + ";NRDGS " + STR$(n%) + ", TIMER" 'Turn on the input buffer PRINT #gpibout%, "OUTPUT " + hp3458addr$ + ";INBUF ON" 'Trigger the readings PRINT #gpibout%, "OUTPUT " + hp3458addr$ + ";TRIG SGL" END SUB