'Open the parameter file REM $INCLUDE: 'param.inc' SUB dac488hrgetv (dacv!) '**************************************************************************** 'This subroutine gets the output voltage from the IOTech DAC488HR/2 output. ' 'Input parameters: ' gpibinP%, GPIB input file number ' gpiboutP%, GPIB output file number ' dacaddrP%, the DAC GPIB address ' 'Output: ' dacv!, the DAC voltage which is being output ' 'Zachary Wolf '4/19/94 '**************************************************************************** 'Get the GPIB I/O file numbers and the DAC address gpibin% = gpibinP% gpibout% = gpiboutP% dacaddr% = dac488hraddrP% 'Put the DAC address in a string dacaddr$ = STR$(dacaddr%) 'Set the GPIB terminators for the DAC PRINT #gpibout%, "TERM OUT LF EOI" PRINT #gpibout%, "TERM IN LF EOI" 'Get the DAC voltage value PRINT #gpibout%, "output " + dacaddr$ + ";V? X" PRINT #gpibout%, "enter " + dacaddr$ INPUT #gpibin%, dacv$ dacv$ = MID$(dacv$, 2) dacv! = VAL(dacv$) END SUB SUB dac488hrinit '**************************************************************************** 'This subroutine initializes the IOTech DAC488HR/2. ' 'Inputs from param.inc: ' gpibinP%, GPIB input file number ' gpiboutP%, GPIB output file number ' dacaddrP%, the DAC GPIB address ' 'Zachary Wolf '4/19/94 '**************************************************************************** 'Get the GPIB I/O file numbers and the DAC address from the parameters gpibin% = gpibinP% gpibout% = gpiboutP% dacaddr% = dac488hraddrP% 'Put the DAC address in a string dacaddr$ = STR$(dacaddr%) 'Set the GPIB terminators for the DAC PRINT #gpibout%, "TERM OUT LF EOI" PRINT #gpibout%, "TERM IN LF EOI" 'Message PRINT PRINT "Resetting the DAC..." 'Reset the DAC PRINT #gpibout%, "OUTPUT " + dacaddr$ + ";*RX" 'Wait until the DAC is reset SLEEP 2 spoll! = 0 WHILE NOT spoll AND 4 PRINT #gpibout%, "SPOLL " + dacaddr$ INPUT #gpibin%, spoll! ' PRINT "spoll = "; spoll! SLEEP 1 WEND 'Get the DAC ID PRINT #gpibout%, "output " + dacaddr$ + ";U9 X" PRINT #gpibout%, "enter " + dacaddr$ INPUT #gpibin%, a$, b$, c$, d$ PRINT a$; " "; b$; " "; c$; " "; d$ END SUB SUB dac488hrsetupv '**************************************************************************** 'This subroutine sets up the IOTech DAC488HR/2 for static DC output. ' 'Inputs from param.inc: ' gpibinP%, GPIB input file number ' gpiboutP%, GPIB output file number ' dacaddrP%, the DAC GPIB address ' 'Zachary Wolf '4/19/94 '**************************************************************************** 'Get the GPIB I/O file numbers and the DAC address from the parameters gpibin% = gpibinP% gpibout% = gpiboutP% dacaddr% = dac488hraddrP% 'Put the DAC address in a string dacaddr$ = STR$(dacaddr%) 'Set the GPIB terminators for the DAC PRINT #gpibout%, "TERM OUT LF EOI" PRINT #gpibout%, "TERM IN LF EOI" 'Set the output port to # 1 PRINT #gpibout%, "output " + dacaddr$ + ";P1 X" 'Set the voltage range to 5 V unipolar PRINT #gpibout%, "output " + dacaddr$ + ";R7 X" 'Set the data format to signed volts PRINT #gpibout%, "output " + dacaddr$ + ";F0 X" 'Set the initial voltage value to 0 PRINT #gpibout%, "output " + dacaddr$ + ";V0 X" END SUB SUB dac488hrv (v!) '**************************************************************************** 'This subroutine has the IOTech DAC488HR/2 output a voltage v!. ' 'Input: ' v!, the voltage to output ' 'Input parameters: ' gpibinP%, GPIB input file number ' gpiboutP%, GPIB output file number ' dac488hraddrP%, the DAC GPIB address ' 'Zachary Wolf '4/19/94 '**************************************************************************** 'Get the GPIB I/O file numbers and the DAC address gpibin% = gpibinP% gpibout% = gpiboutP% dacaddr% = dac488hraddrP% 'Put the DAC address in a string dacaddr$ = STR$(dacaddr%) 'Set the GPIB terminators for the DAC PRINT #gpibout%, "TERM OUT LF EOI" PRINT #gpibout%, "TERM IN LF EOI" 'Make sure the voltage is within the proper range IF v! < 0! THEN v! = 0! IF v! > 5! THEN v! = 5! 'Output the voltage to the DAC PRINT #gpibout%, "OUTPUT " + dacaddr$ + ";V"; PRINT #gpibout%, USING "###.#####"; v!; PRINT #gpibout%, " X" END SUB