'**************************************************************************** 'Module HP3458 'This module contains I/O subroutines for the HP3458. ' 'Zachary Wolf '9/21/95 '**************************************************************************** 'Common area for shared parameters COMMON SHARED /hp3458/ gpibinP%, gpiboutP%, hp3458addrP$ 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 ' 'Zachary Wolf '2/3/95 '**************************************************************************** 'Set the GPIB terminators PRINT #gpiboutP%, "TERM IN CR LF" PRINT #gpiboutP%, "TERM OUT CR LF EOI" 'Make sure the meter is ready for instructions bit4% = 0 WHILE bit4% = 0 SLEEP 1 PRINT #gpiboutP%, "SPOLL " + hp3458addrP$ INPUT #gpibinP%, status% bit4% = INT(status% / 16) MOD 2 'PRINT status%, bit4% WEND 'Turn off the input buffer PRINT #gpiboutP%, "OUTPUT " + hp3458addrP$ + ";INBUF OFF" 'Check for errors PRINT #gpiboutP%, "OUTPUT " + hp3458addrP$ + ";ERR?" PRINT #gpiboutP%, "ENTER " + hp3458addrP$ INPUT #gpibinP%, 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 #gpiboutP%, "ENTER " + hp3458addrP$ INPUT #gpibinP%, v!(i%) NEXT i% 'Clear the GPIB extender boxes, if used, after the SPOLL PRINT #gpiboutP%, "ABORT" END SUB SUB hp3458getv (v!) '**************************************************************************** 'This subroutine takes a voltage reading and returns the value. 'It assumes the meter has previously been configured to take the reading. ' 'Output: ' v!, the measured voltage ' 'Zachary Wolf '3/7/96 '**************************************************************************** 'Set the GPIB terminators PRINT #gpiboutP%, "TERM IN CR LF" PRINT #gpiboutP%, "TERM OUT CR LF EOI" 'Trigger the reading PRINT #gpiboutP%, "OUTPUT " + hp3458addrP$ + ";TRIG SGL" 'Get the reading PRINT #gpiboutP%, "ENTER " + hp3458addrP$ INPUT #gpibinP%, v! END SUB SUB hp3458init '**************************************************************************** 'This subroutine resets the HP3458. It then does some simple checks. ' 'Zachary Wolf '2/22/94, 2/2/95 '**************************************************************************** 'Set the GPIB terminators PRINT #gpiboutP%, "TERM IN CR LF" PRINT #gpiboutP%, "TERM OUT CR LF EOI" 'Message PRINT PRINT "Resetting the HP3458..." 'Clear the hp3458 PRINT #gpiboutP%, "CLEAR " + hp3458addrP$ 'Preset PRINT #gpiboutP%, "OUTPUT " + hp3458addrP$ + ";PRESET NORM" 'Display the ID PRINT #gpiboutP%, "OUTPUT " + hp3458addrP$ + ";ID?" PRINT #gpiboutP%, "ENTER " + hp3458addrP$ LINE INPUT #gpibinP%, 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 ' 'Zachary Wolf '2/3/95 '**************************************************************************** 'Set the GPIB terminators PRINT #gpiboutP%, "TERM IN CR LF" PRINT #gpiboutP%, "TERM OUT CR LF EOI" 'Preset the HP3458 PRINT #gpiboutP%, "OUTPUT " + hp3458addrP$ + ";PRESET" 'Measure DC Volts PRINT #gpiboutP%, "OUTPUT " + hp3458addrP$ + ";FUNC DCV" 'Set the voltage range PRINT #gpiboutP%, "OUTPUT " + hp3458addrP$ + ";RANGE .1" 'Set the A/D integration time PRINT #gpiboutP%, "OUTPUT " + hp3458addrP$ + ";NPLC 1" 'Turn off the autozero PRINT #gpiboutP%, "OUTPUT " + hp3458addrP$ + ";AZERO OFF" 'Turn off the display PRINT #gpiboutP%, "OUTPUT " + hp3458addrP$ + ";DISP OFF" 'Set the timer PRINT #gpiboutP%, "OUTPUT " + hp3458addrP$ + ";TIMER " + STR$(t!) 'Send the readings to the memory PRINT #gpiboutP%, "OUTPUT " + hp3458addrP$ + ";MEM FIFO" 'Set up the trigger PRINT #gpiboutP%, "OUTPUT " + hp3458addrP$ + ";TARM AUTO" PRINT #gpiboutP%, "OUTPUT " + hp3458addrP$ + ";NRDGS " + STR$(n%) + ", TIMER" 'Turn on the input buffer PRINT #gpiboutP%, "OUTPUT " + hp3458addrP$ + ";INBUF ON" 'Trigger the readings PRINT #gpiboutP%, "OUTPUT " + hp3458addrP$ + ";TRIG SGL" 'Make sure the meter is ready for instructions bit4% = 0 WHILE bit4% = 0 SLEEP 1 PRINT #gpiboutP%, "SPOLL " + hp3458addrP$ INPUT #gpibinP%, status% bit4% = INT(status% / 16) MOD 2 ' PRINT status%, bit4% WEND 'Turn off the input buffer PRINT #gpiboutP%, "OUTPUT " + hp3458addrP$ + ";INBUF OFF" 'Check for errors PRINT #gpiboutP%, "OUTPUT " + hp3458addrP$ + ";ERR?" PRINT #gpiboutP%, "ENTER " + hp3458addrP$ INPUT #gpibinP%, 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 #gpiboutP%, "ENTER " + hp3458addrP$ INPUT #gpibinP%, v!(i%) NEXT i% END SUB SUB hp3458setpar (gpibin%, gpibout%, hp3458addr$) '**************************************************************************** 'This subroutine sets the parameters for the HP3458. ' 'Input: ' gpibin%, gpib input file number ' gpibout%, gpib output file number ' hp3458addr$, gpib address in a string ' 'Zachary Wolf '2/22/94, 2/2/95 '**************************************************************************** 'Make sure the input parameters have reasonable values IF gpibin% < 0 OR gpibin% > 100 THEN PRINT "HP3458: GPIB problem" EXIT SUB END IF IF gpibout% < 0 OR gpibout% > 100 THEN PRINT "HP3458: GPIB problem" EXIT SUB END IF IF hp3458addr$ = "" THEN PRINT "HP3458: GPIB problem" EXIT SUB END IF 'Save the GPIB information in a common block for future use gpibinP% = gpibin% gpiboutP% = gpibout% hp3458addrP$ = hp3458addr$ END SUB SUB hp3458setupv '**************************************************************************** 'This subroutine sets up the HP3458 to take a voltage reading. ' 'Zachary Wolf '3/7/96 '**************************************************************************** 'Set the GPIB terminators PRINT #gpiboutP%, "TERM IN CR LF" PRINT #gpiboutP%, "TERM OUT CR LF EOI" 'Preset the HP3458 PRINT #gpiboutP%, "OUTPUT " + hp3458addrP$ + ";PRESET" 'Set the A/D integration time PRINT #gpiboutP%, "OUTPUT " + hp3458addrP$ + ";NPLC 1" 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 ' 'Zachary Wolf '2/3/95 '**************************************************************************** 'Set the GPIB terminators PRINT #gpiboutP%, "TERM IN CR LF" PRINT #gpiboutP%, "TERM OUT CR LF EOI" 'Preset the HP3458 PRINT #gpiboutP%, "OUTPUT " + hp3458addrP$ + ";PRESET" 'Measure DC Volts PRINT #gpiboutP%, "OUTPUT " + hp3458addrP$ + ";FUNC DCV" 'Set the voltage range PRINT #gpiboutP%, "OUTPUT " + hp3458addrP$ + ";RANGE .1" 'Set the A/D integration time PRINT #gpiboutP%, "OUTPUT " + hp3458addrP$ + ";NPLC 2" 'Turn off the autozero PRINT #gpiboutP%, "OUTPUT " + hp3458addrP$ + ";AZERO OFF" 'Turn off the display PRINT #gpiboutP%, "OUTPUT " + hp3458addrP$ + ";DISP OFF" 'Set the delay value PRINT #gpiboutP%, "OUTPUT " + hp3458addrP$ + ";DELAY .1" 'Set the timer PRINT #gpiboutP%, "OUTPUT " + hp3458addrP$ + ";TIMER " + STR$(t!) 'Send the readings to the memory PRINT #gpiboutP%, "OUTPUT " + hp3458addrP$ + ";MEM FIFO" 'Set up the trigger PRINT #gpiboutP%, "OUTPUT " + hp3458addrP$ + ";TARM AUTO" PRINT #gpiboutP%, "OUTPUT " + hp3458addrP$ + ";NRDGS " + STR$(n%) + ", TIMER" 'Turn on the input buffer PRINT #gpiboutP%, "OUTPUT " + hp3458addrP$ + ";INBUF ON" 'Trigger the readings PRINT #gpiboutP%, "OUTPUT " + hp3458addrP$ + ";TRIG SGL" END SUB SUB hp3458v (v!) '**************************************************************************** 'This subroutine takes a voltage reading and returns the value. ' 'Output: ' v!, the measured voltage ' 'Zachary Wolf '3/7/96 '**************************************************************************** 'Set the GPIB terminators PRINT #gpiboutP%, "TERM IN CR LF" PRINT #gpiboutP%, "TERM OUT CR LF EOI" 'Preset the HP3458 PRINT #gpiboutP%, "OUTPUT " + hp3458addrP$ + ";PRESET" 'Set the A/D integration time PRINT #gpiboutP%, "OUTPUT " + hp3458addrP$ + ";NPLC 1" 'Trigger the reading PRINT #gpiboutP%, "OUTPUT " + hp3458addrP$ + ";TRIG SGL" 'Get the reading PRINT #gpiboutP%, "ENTER " + hp3458addrP$ INPUT #gpibinP%, v! END SUB