DECLARE SUB LS450ReadData () DECLARE SUB ls450getb (b!) DECLARE SUB ls450init () DECLARE SUB ls450setpar (gpibinf%, gpiboutf%, ls450addr$) DECLARE SUB ls450zero () DECLARE SUB ls450fastmode (sel%) DECLARE SUB ls450fast () DECLARE SUB LS450menu (selection$) DECLARE SUB gpibclr () '**************************************************************************** 'Module LS450 'This module contains subroutines to read the Lake Shore Model 450 'teslameter. ' 'Zachary Wolf '6/12/94 '**************************************************************************** 'Common area for shared parameters COMMON SHARED /LS450/ gpibinP%, gpiboutP%, ls450addrP$ COMMON SHARED /flyinfo/ flyvolt!, trndcv!, ramprate!, bfield!(), r%, task$ SUB LS450 CALL ls450setpar(gpibinP%, gpiboutP%, ls450addrP$) WHILE selection$ <> "END" CALL LS450menu(selection$) IF selection$ = "Initialize" THEN CALL ls450init IF selection$ = "Zero" THEN CALL ls450zero IF selection$ = "FastMode" THEN CALL ls450fast IF selection$ = "GetData" THEN CALL LS450ReadData IF selection$ = "END" THEN EXIT SUB PRINT : PRINT "Enter to continue: "; INPUT resp$ WEND END SUB SUB ls450fast PRINT "Select LS450 Fast Mode [Y or N]: "; INPUT mode$ mode$ = UCASE$(mode$) IF mode$ = "" THEN EXIT SUB IF mode$ = "Y" THEN CALL ls450fastmode(1) IF mode$ = "N" THEN CALL ls450fastmode(0) END SUB SUB ls450fastb (b!) 'Set the GPIB terminators PRINT #gpiboutP%, "TERM IN CR LF" PRINT #gpiboutP%, "TERM OUT CR LF" 'Get the reading PRINT #gpiboutP%, "OUTPUT " + ls450addrP$ + "; FIELD?" PRINT #gpiboutP%, "ENTER " + ls450addrP$ INPUT #gpibinP%, b! bfield!(r%) = b! END SUB SUB ls450fastmode (sel%) mode$ = LTRIM$(STR$(sel%)) 'Turn on Fast Mode PRINT #gpiboutP%, "OUTPUT" + ls450addrP$ + ";FAST " + mode$ END SUB SUB ls450getb (b!) '**************************************************************************** 'This subroutine has the Lake Shore Model 450 teslameter measure the 'magnetic field. ' 'Output: ' b!, the measured magnetic field strength in Tesla ' 'Zachary Wolf '6/12/94 '**************************************************************************** 'Set the GPIB terminators PRINT #gpiboutP%, "TERM IN CR LF" PRINT #gpiboutP%, "TERM OUT CR LF" 'Make sure the meter is ready to send data stb% = 0 WHILE NOT stb% AND 1 'Bit 0 is Field Data Ready PRINT #gpiboutP%, "SPOLL " + ls450addrP$ INPUT #gpibinP%, stb% ' PRINT stb% WEND 'Make sure the meter is not overloaded PRINT #gpiboutP%, "SPOLL " + ls450addrP$ INPUT #gpibinP%, stb% IF stb% AND 16 THEN 'Bit 4 is Overload Indicator PRINT "The Gaussmeter is overloaded!" b! = 0! EXIT SUB END IF 'Check that the reading will have appropriate units PRINT #gpiboutP%, "OUTPUT " + ls450addrP$ + "; UNIT?" PRINT #gpiboutP%, "ENTER " + ls450addrP$ INPUT #gpibinP%, units$ IF units$ <> "T" THEN PRINT "The Gaussmeter units are not Tesla, exiting." b! = 0! EXIT SUB END IF 'Get the reading PRINT #gpiboutP%, "OUTPUT " + ls450addrP$ + "; FIELD?" PRINT #gpiboutP%, "ENTER " + ls450addrP$ INPUT #gpibinP%, b! 'Get the multiplier PRINT #gpiboutP%, "OUTPUT " + ls450addrP$ + "; FIELDM?" PRINT #gpiboutP%, "ENTER " + ls450addrP$ INPUT #gpibinP%, mult$ IF mult$ = "u" THEN b! = b! / 1000000! ELSEIF mult$ = "m" THEN b! = b! / 1000! ELSEIF mult$ = "k" THEN b! = b! * 1000! ELSEIF mult$ = "" THEN b! = b! ELSE PRINT "Unknown field multiplier: "; mult$ b! = 0! EXIT SUB END IF 'After the SPOLL, clear the GPIB for the extenders CALL gpibclr bfield! = b! END SUB SUB ls450init '**************************************************************************** 'This subroutine initializes the Lake Shore 450 Gaussmeter. ' 'Zachary Wolf '12/11/95 '**************************************************************************** 'Set the GPIB terminators PRINT #gpiboutP%, "TERM IN CR LF" PRINT #gpiboutP%, "TERM OUT CR LF" 'Message PRINT PRINT "Resetting the Lake Shore 450 Gaussmeter..." 'Reset the LS450 PRINT #gpiboutP%, "OUTPUT " + ls450addrP$ + ";*RST" 'Put Gaussmeter in DC measurement mode PRINT #gpiboutP%, "OUTPUT " + ls450addrP$ + ";ACDC 0" 'Turn off digital filtering PRINT #gpiboutP%, "OUTPUT " + ls450addrP$ + ";FILT 0" 'Set the units to Tesla PRINT #gpiboutP%, "OUTPUT " + ls450addrP$ + ";UNIT T" 'Turn on max-hold PRINT #gpiboutP%, "OUTPUT " + ls450addrP$ + ";MAX 1" 'Turn on autoranging PRINT #gpiboutP%, "OUTPUT " + ls450addrP$ + ";AUTO 1" 'Turn on field compensation PRINT #gpiboutP%, "OUTPUT " + ls450addrP$ + ";FCOMP 1" 'Turn on temperature compensation PRINT #gpiboutP%, "OUTPUT " + ls450addrP$ + ";TCOMP 1" 'Turn off relative mode PRINT #gpiboutP%, "OUTPUT " + ls450addrP$ + ";REL 0" 'Turn off alarms PRINT #gpiboutP%, "OUTPUT " + ls450addrP$ + ";ALARM 0" 'Set bits in the standard event status enable register PRINT #gpiboutP%, "OUTPUT " + ls450addrP$ + ";*ESE 189" 'turn on all bits 'Set bits in the status byte enable register PRINT #gpiboutP%, "OUTPUT " + ls450addrP$ + ";*SRE 55" 'turn on bits 0,1,2,4,5 'Display the Gaussmeter ID PRINT #gpiboutP%, "OUTPUT " + ls450addrP$ + ";*IDN?" PRINT #gpiboutP%, "ENTER " + ls450addrP$ LINE INPUT #gpibinP%, id$ PRINT id$ 'Display the probe serial number PRINT #gpiboutP%, "OUTPUT " + ls450addrP$ + ";SNUM?" PRINT #gpiboutP%, "ENTER " + ls450addrP$ LINE INPUT #gpibinP%, snum$ PRINT "Probe: "; snum$ 'Display the probe type PRINT #gpiboutP%, "OUTPUT " + ls450addrP$ + ";TYPE?" PRINT #gpiboutP%, "ENTER " + ls450addrP$ LINE INPUT #gpibinP%, type$ PRINT "Type: "; type$ END SUB SUB LS450menu (selection$) CLS PRINT "SR770 Spectrum Analyzer" PRINT PRINT "Menu selection for operation:" PRINT PRINT "1) Initialize the LS450" PRINT "2) Zero the Hall Probe" PRINT "3) Fast mode selection." PRINT "4) Read data" PRINT "5) Exit from menu." PRINT WHILE sel% < 1 OR sel% > 5 PRINT "Enter LS450 menu selection: "; INPUT sel% WEND IF sel% = 1 THEN selection$ = "Initialize" IF sel% = 2 THEN selection$ = "Zero" IF sel% = 3 THEN selection$ = "FastMode" IF sel% = 4 THEN selection$ = "GetData" IF sel% = 5 THEN selection$ = "END" END SUB SUB LS450ReadData PRINT "Taking 5 reading of the LS450 Gaussmeter..." FOR i% = 1 TO 5 CALL ls450getb(bfield!) PRINT USING "##) ##.##### Tesla"; i%; bfield! NEXT END SUB SUB ls450setpar (gpibinf%, gpiboutf%, ls450addr$) '**************************************************************************** 'This subroutine initializes the Lake Shore 450 Gaussmeter. ' 'Input: ' gpibinf%, gpib input file number ' gpiboutf%, gpib output file number ' ls450addr$, gpib address in a string ' 'Zachary Wolf '12/11/95 '**************************************************************************** 'Make sure the input parameters have reasonable values IF gpibinf% < 0 OR gpibinf% > 100 THEN PRINT "LS450: GPIB problem" EXIT SUB END IF IF gpiboutf% < 0 OR gpiboutf% > 100 THEN PRINT "LS450: GPIB problem" EXIT SUB END IF IF ls450addr$ = "" THEN PRINT "LS450: GPIB problem" EXIT SUB END IF 'Save the GPIB information in a common block for future use gpibinP% = gpibinf% gpiboutP% = gpiboutf% ls450addrP$ = ls450addr$ END SUB SUB ls450setrange (r%) '**************************************************************************** 'This subroutine sets the range of the Lake Shore 450 Gaussmeter. ' 'Input: ' r%, the range number ' 'Zachary Wolf '12/11/95 '**************************************************************************** 'Set the GPIB terminators PRINT #gpiboutP%, "TERM IN CR LF" PRINT #gpiboutP%, "TERM OUT CR LF" 'Set the measurement range PRINT #gpiboutP%, "OUTPUT " + ls450addrP$ + "; RANGE " + LTRIM$(STR$(r%)) END SUB SUB ls450setupb 'Set the GPIB terminators PRINT #gpiboutP%, "TERM IN CR LF" PRINT #gpiboutP%, "TERM OUT CR LF" 'Message PRINT PRINT "Resetting the Lake Shore 450 Gaussmeter..." 'Reset the LS450 PRINT #gpiboutP%, "OUTPUT " + ls450addrP$ + ";*RST" 'Put Gaussmeter in DC measurement mode PRINT #gpiboutP%, "OUTPUT " + ls450addrP$ + ";ACDC 0" 'Turn off digital filtering PRINT #gpiboutP%, "OUTPUT " + ls450addrP$ + ";FILT 0" 'Set the units to Tesla PRINT #gpiboutP%, "OUTPUT " + ls450addrP$ + ";UNIT T" 'Turn on max-hold PRINT #gpiboutP%, "OUTPUT " + ls450addrP$ + ";MAX 1" 'Select range PRINT #gpiboutP%, "OUTPUT " + ls450addrP$ + ";RANGE 2" 'Turn on field compensation PRINT #gpiboutP%, "OUTPUT " + ls450addrP$ + ";FCOMP 1" 'Turn on temperature compensation PRINT #gpiboutP%, "OUTPUT " + ls450addrP$ + ";TCOMP 1" 'Turn off relative mode PRINT #gpiboutP%, "OUTPUT " + ls450addrP$ + ";REL 0" 'Turn off alarms PRINT #gpiboutP%, "OUTPUT " + ls450addrP$ + ";ALARM 0" 'Set bits in the standard event status enable register PRINT #gpiboutP%, "OUTPUT " + ls450addrP$ + ";*ESE 189" 'turn on all bits 'Set bits in the status byte enable register PRINT #gpiboutP%, "OUTPUT " + ls450addrP$ + ";*SRE 55" 'turn on bits 0,1,2,4,5 END SUB SUB ls450zero '**************************************************************************** 'This subroutine zeros the Lake Shore 450 Gaussmeter. ' 'Zachary Wolf '12/11/95 '**************************************************************************** 'Set the GPIB terminators PRINT #gpiboutP%, "TERM IN CR LF" PRINT #gpiboutP%, "TERM OUT CR LF" 'Message PRINT PRINT "Lake Shore 450 Gaussmeter Zero" PRINT "Please place the Hall probe into a 0 Gauss chamber." INPUT "Press ENTER when ready. ", a$ PRINT "Zeroing the Lake Shore 450 Gaussmeter..." 'Zero the Gaussmeter PRINT #gpiboutP%, "OUTPUT " + ls450addrP$ + "; ZCAL" 'Message PRINT "The Hall probe is zeroed." END SUB