'**************************************************************************** 'Module DAC488 'This module contains I/O subroutines for the DAC488. ' 'The following parameters must be present in param.inc. 'gpibinP%, the GPIB input file number 'gpiboutP%, the GPIB output file number 'dac488addrP%, the IOTech DAC488 GPIB address '**************************************************************************** 'Open the parameter file REM $INCLUDE: 'param.inc' SUB dac488do0 (d%) '**************************************************************************** 'This subroutine has the IOTech DAC488 output a low TTL level on digital line 'number d% (1 to 8). ' 'Input: ' d%, line number 1 to 8 ' 'Input parameters: ' gpibinP%, GPIB input file number ' gpiboutP%, GPIB output file number ' dac488addrP%, the DAC GPIB address ' 'Zachary Wolf '6/24/94 '**************************************************************************** 'Get the GPIB I/O file numbers and the DAC address gpibin% = gpibinP% gpibout% = gpiboutP% dacaddr% = dac488gpibaddrP% '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 existing output digital port configuration PRINT #gpibout%, "OUTPUT " + dacaddr$ + ";D?" PRINT #gpibout%, "ENTER " + dacaddr$ INPUT #gpibin%, p$ 'Remove the leading D p$ = MID$(p$, 2) 'Extract the value p% = VAL(p$) 'Convert the line number to an integer with the appropriate bit pattern dp% = 2 ^ (d% - 1) 'Leave existing lines alone, except make line d% low dp% = NOT dp% p% = p% AND dp% 'Get the integer equivalent of the bit pattern and put it in a string p$ = LTRIM$(STR$(p%)) 'Send the new port configuration PRINT #gpibout%, "OUTPUT " + dacaddr$ + ";D" + p$ + " X" END SUB SUB dac488do1 (d%) '**************************************************************************** 'This subroutine has the IOTech DAC488 output a high TTL level on digital line 'number d% (1 to 8). ' 'Input: ' d%, line number 1 to 8 ' 'Input parameters: ' gpibinP%, GPIB input file number ' gpiboutP%, GPIB output file number ' dac488addrP%, the DAC GPIB address ' 'Zachary Wolf '6/24/94 '**************************************************************************** 'Get the GPIB I/O file numbers and the DAC address gpibin% = gpibinP% gpibout% = gpiboutP% dacaddr% = dac488gpibaddrP% '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 existing output digital port configuration PRINT #gpibout%, "OUTPUT " + dacaddr$ + ";D?" PRINT #gpibout%, "ENTER " + dacaddr$ INPUT #gpibin%, p$ 'Remove the leading D p$ = MID$(p$, 2) 'Extract the value p% = VAL(p$) 'Convert the line number to an integer with the appropriate bit pattern dp% = 2 ^ (d% - 1) 'Leave existing lines alone, except make line d% high p% = p% OR dp% 'Get the integer equivalent of the bit pattern and put it in a string p$ = LTRIM$(STR$(p%)) 'Send the new port configuration PRINT #gpibout%, "OUTPUT " + dacaddr$ + ";D" + p$ + " X" END SUB SUB dac488getv (dacv!) '**************************************************************************** 'This subroutine gets the output voltage from the IOTech DAC488 analog 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, 9/10/94 '**************************************************************************** 'Get the GPIB I/O file numbers and the DAC address gpibin% = gpibinP% gpibout% = gpiboutP% dacaddr% = dac488gpibaddrP% '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 dac488init '**************************************************************************** 'This subroutine initializes the IOTech DAC488. ' 'Inputs from param.inc: ' gpibinP%, GPIB input file number ' gpiboutP%, GPIB output file number ' dacaddrP%, the DAC GPIB address ' 'Zachary Wolf '6/24/94 '**************************************************************************** 'Get the GPIB I/O file numbers and the DAC address from the parameters gpibin% = gpibinP% gpibout% = gpiboutP% dacaddr% = dac488gpibaddrP% '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%, "CLEAR " + dacaddr$ 'Set the DAC terminators to LF EOI PRINT #gpibout%, "OUTPUT " + dacaddr$ + ";Y3 X" 'LF PRINT #gpibout%, "OUTPUT " + dacaddr$ + ";K0 X" 'EOI 'Turn the test LED on and off PRINT #gpibout%, "OUTPUT " + dacaddr$ + ";W1 X" PRINT #gpibout%, "OUTPUT " + dacaddr$ + ";W0 X" 'Get the DAC ID PRINT #gpibout%, "OUTPUT " + dacaddr$ + ";U0 X" PRINT #gpibout%, "ENTER " + dacaddr$ LINE INPUT #gpibin%, a$ PRINT a$ END SUB SUB dac488setupv '**************************************************************************** 'This subroutine sets up the IOTech DAC488 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 '9/10/94 '**************************************************************************** 'Get the GPIB I/O file numbers and the DAC address from the parameters gpibin% = gpibinP% gpibout% = gpiboutP% dacaddr% = dac488gpibaddrP% '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 control mode to trigger on X PRINT #gpibout%, "OUTPUT " + dacaddr$ + ";C0 X" 'Set the output port to # 1 PRINT #gpibout%, "OUTPUT " + dacaddr$ + ";P1 X" 'Turn off autoranging PRINT #gpibout%, "OUTPUT " + dacaddr$ + ";A0 X" 'Set the voltage range to +-5 V PRINT #gpibout%, "OUTPUT " + dacaddr$ + ";R2 X" 'Set the output data format to signed volts PRINT #gpibout%, "OUTPUT " + dacaddr$ + ";O0 X" 'Set the initial voltage value to 0 PRINT #gpibout%, "OUTPUT " + dacaddr$ + ";V0 X" END SUB SUB dac488v (v!) '**************************************************************************** 'This subroutine has the IOTech DAC488 output a voltage v!. ' 'Input: ' v!, the voltage to output ' 'Input parameters: ' gpibinP%, GPIB input file number ' gpiboutP%, GPIB output file number ' dac488addrP%, the DAC GPIB address ' 'Zachary Wolf '9/10/94 '**************************************************************************** 'Get the GPIB I/O file numbers and the DAC address gpibin% = gpibinP% gpibout% = gpiboutP% dacaddr% = dac488gpibaddrP% '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