'**************************************************************************** 'Module DAC488HR 'This module contains I/O subroutines for the DAC488HR. ' 'The following parameters must be present in param.inc. 'gpibinP%, the GPIB input file number 'gpiboutP%, the GPIB output file number 'dac488hraddrP%, the IOTech DAC488HR/2 GPIB address '**************************************************************************** '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 "Initializing the DAC..." 'Get the DAC ID PRINT #gpibout%, "OUTPUT " + dacaddr$ + ";U9 X" PRINT #gpibout%, "ENTER " + dacaddr$ LINE INPUT #gpibin%, a$ PRINT a$ 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 data format to signed volts PRINT #gpibout%, "OUTPUT " + dacaddr$ + ";F0 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