'**************************************************************************** '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 dac488doutoff (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% = dac488addrP% '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 dac488douton (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% = dac488addrP% '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 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% = dac488addrP% '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