'**************************************************************************** 'Module DS335 'This module contains I/O subroutines for the Stanford Research DS335 'function generator. ' 'Zachary Wolf '5/9/95 '**************************************************************************** 'Open the parameter file REM $INCLUDE: 'param.inc' SUB ds335getv (v!) '**************************************************************************** 'This subroutine gets the offset voltage from the DS355 function generator. ' 'Output: ' v!, the offset voltage which is being output ' 'Zachary Wolf '5/9/95 '**************************************************************************** 'Get the GPIB I/O file numbers and the DAC address gpibin% = gpibinP% gpibout% = gpiboutP% dacaddr% = ds335addrP% 'Put the DAC address in a string dacaddr$ = LTRIM$(STR$(dacaddr%)) 'Set the GPIB terminators for the DAC PRINT #gpibout%, "TERM OUT LF" PRINT #gpibout%, "TERM IN LF EOI" 'Get the DAC voltage value PRINT #gpibout%, "OUTPUT " + dacaddr$ + ";OFFS?" PRINT #gpibout%, "ENTER " + dacaddr$ INPUT #gpibin%, v$ v! = VAL(v$) 'For debugging 'PRINT "Voffset = "; v! END SUB SUB ds335init '**************************************************************************** 'This subroutine initializes the Stanford Research DS335. ' 'Zachary Wolf '5/9/95 '**************************************************************************** 'Get the GPIB I/O file numbers and the DAC address from the parameters gpibin% = gpibinP% gpibout% = gpiboutP% dacaddr% = ds335addrP% 'Put the DAC address in a string dacaddr$ = LTRIM$(STR$(dacaddr%)) 'Set the GPIB terminators for the DAC PRINT #gpibout%, "TERM OUT LF" PRINT #gpibout%, "TERM IN LF EOI" 'Message PRINT PRINT "Resetting the DS335..." 'Set the output voltage amplitude to 0, allows only DC offsets PRINT #gpibout%, "OUTPUT " + dacaddr$ + ";AMPL 0.00VP" 'Set the DC offset to 0 PRINT #gpibout%, "OUTPUT " + dacaddr$ + ";OFFS 0.00" 'Set the generator to look into a high impedance PRINT #gpibout%, "OUTPUT " + dacaddr$ + ";TERM 1" 'Set the function to a sine wave, for completeness PRINT #gpibout%, "OUTPUT " + dacaddr$ + ";FUNC 0" 'Set the frequency to 1MHz, so the PS won't see it in case there is a problem PRINT #gpibout%, "OUTPUT " + dacaddr$ + ";FREQ 100000." 'Turn off sweeps PRINT #gpibout%, "OUTPUT " + dacaddr$ + ";SWEN 0" 'Get the DS335 ID PRINT #gpibout%, "OUTPUT " + dacaddr$ + ";*IDN?" PRINT #gpibout%, "ENTER " + dacaddr$ LINE INPUT #gpibin%, a$ PRINT a$ 'Get the DS335 amplitude PRINT #gpibout%, "OUTPUT " + dacaddr$ + ";AMPL?" PRINT #gpibout%, "ENTER " + dacaddr$ LINE INPUT #gpibin%, a$ PRINT "Amplitude = "; a$; 'Get the DS335 offset PRINT #gpibout%, "OUTPUT " + dacaddr$ + ";OFFS?" PRINT #gpibout%, "ENTER " + dacaddr$ LINE INPUT #gpibin%, a$ PRINT ", Offset = "; a$; " V" END SUB SUB ds335v (v!) '**************************************************************************** 'This subroutine has the DS335 output a voltage v!. ' 'Input: ' v!, the voltage to output ' 'Zachary Wolf '5/9/95 '**************************************************************************** 'Get the GPIB I/O file numbers and the DAC address gpibin% = gpibinP% gpibout% = gpiboutP% dacaddr% = ds335addrP% 'Put the DAC address in a string dacaddr$ = STR$(dacaddr%) 'Set the GPIB terminators for the DAC PRINT #gpibout%, "TERM OUT LF" PRINT #gpibout%, "TERM IN LF EOI" 'Make sure the voltage is within the proper range IF v! < 0! THEN v! = 0! IF v! > 10! THEN v! = 10! 'Output the voltage to the DAC PRINT #gpibout%, "OUTPUT " + dacaddr$ + ";OFFS "; PRINT #gpibout%, USING "###.######"; v! END SUB