DECLARE SUB gpibout (addr$, cmd$) DECLARE SUB gpibin (addr$, msg$) DECLARE SUB gpibterm (termin$, termout$) DECLARE SUB gpibclrdev (addr$) DECLARE SUB gp3setrange (r%) DECLARE SUB gpibclr () DECLARE SUB gp3zero () '**************************************************************************** 'Module GP3 'This module contains subroutines to read the Group3 teslameter. ' 'Zachary Wolf '6/12/94, 12/11/95 '**************************************************************************** 'Common area for shared parameters COMMON SHARED /gp3/ gpibinP%, gpiboutP%, gp3addrP$ 'Semi-permanent parameters CONST gp3terminP$ = "LF EOI" CONST gp3termoutP$ = "LF EOI" SUB gp3getb (b!) '**************************************************************************** 'This subroutine has the Group3 teslameter measure the magnetic field. ' 'Output: ' b!, the measured magnetic field strength in Tesla ' 'Zachary Wolf '6/12/94, 12/11/95 '**************************************************************************** 'Set the GPIB terminators CALL gpibterm(gp3terminP$, gp3termoutP$) 'Get the reading CALL gpibout(gp3addrP$, "F") CALL gpibin(gp3addrP$, b$) 'PRINT "b$ = "; b$ IF b$ = "OVER RANGE" THEN PRINT "GP3: over range" b! = 0! ELSE b! = VAL(b$) END IF END SUB SUB gp3init '**************************************************************************** 'This subroutine initializes the Group3 teslameter. ' 'Zachary Wolf '6/12/94, 12/11/95 '**************************************************************************** 'Set the GPIB terminators CALL gpibterm(gp3terminP$, gp3termoutP$) 'Message PRINT PRINT "Resetting the Group3 teslameter..." 'Clear the gp3 CALL gpibclrdev(gp3addrP$) 'Reset the gp3 CALL gpibout(gp3addrP$, CHR$(24)) SLEEP 3 'Allow time to finish CALL gpibin(gp3addrP$, rst$) PRINT rst$ 'Clear any GPIB extender boxes after the reset CALL gpibclr 'Put DTM in DC measurement mode CALL gpibout(gp3addrP$, "GD") 'Measure continuously CALL gpibout(gp3addrP$, "GC") 'Turn off digital filtering CALL gpibout(gp3addrP$, "D0") 'Use the normal display mode CALL gpibout(gp3addrP$, "NN") 'Send field readings only when requested CALL gpibout(gp3addrP$, "SM0") 'Do not send units CALL gpibout(gp3addrP$, "SU0") 'Set the units to Tesla CALL gpibout(gp3addrP$, "UFT") 'Display status information CALL gpibout(gp3addrP$, "IG") CALL gpibin(gp3addrP$, ig$) CALL gpibout(gp3addrP$, "IN") CALL gpibin(gp3addrP$, in$) CALL gpibout(gp3addrP$, "IR") CALL gpibin(gp3addrP$, ir$) PRINT "Status: "; ig$ + ", " + in$ + ", " + ir$ END SUB SUB gp3setpar (gpibinf%, gpiboutf%, gp3addr$) '**************************************************************************** 'This subroutine initializes the Group 3 Gaussmeter. ' 'Input: ' gpibinf%, gpib input file number ' gpiboutf%, gpib output file number ' gp3addr$, 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 "GP3: GPIB problem" EXIT SUB END IF IF gpiboutf% < 0 OR gpiboutf% > 100 THEN PRINT "GP3: GPIB problem" EXIT SUB END IF IF gp3addr$ = "" THEN PRINT "GP3: GPIB problem" EXIT SUB END IF 'Save the GPIB information in a common block for future use gpibinP% = gpibinf% gpiboutP% = gpiboutf% gp3addrP$ = gp3addr$ END SUB SUB gp3setrange (r%) '**************************************************************************** 'This subroutine sets the range of the Group3 teslameter. ' 'Input: ' r%, the range number, Ranges: 0 = 0.3 T, 1 = 0.6 T, 2 = 1.2 T, 3 = 3.0 T ' 'Zachary Wolf '6/14/94 '**************************************************************************** 'Set the GPIB terminators CALL gpibterm(gp3terminP$, gp3termoutP$) 'Set the measurement range setrange: IF r% >= 0 AND r% <= 3 THEN CALL gpibout(gp3addrP$, "R" + LTRIM$(STR$(r%))) ELSE PRINT PRINT "GP3: Inproper Hall probe range requested." PRINT "What range do you want for the Group 3 Hall probe? (0, 1, 2, 3) " INPUT "Ranges: 0 = 0.3 T, 1 = 0.6 T, 2 = 1.2 T, 3 = 3.0 T >> ", r% GOTO setrange END IF 'Allow time for the meter to change ranges SLEEP 2 END SUB SUB gp3zero '**************************************************************************** 'This subroutine zeros the Group3 teslameter. ' 'Zachary Wolf '6/14/94, 12/11/95 '**************************************************************************** 'Set the GPIB terminators CALL gpibterm(gp3terminP$, gp3termoutP$) 'Message PRINT PRINT "Group 3 Hall Probe Zero" PRINT "Please place the Hall probe into a 0 Gauss chamber." INPUT "Press ENTER when ready. ", a$ PRINT "Zeroing the Group3 teslameter..." PRINT "This will take about 20 seconds." 'Get the present range CALL gpibout(gp3addrP$, "IR") CALL gpibin(gp3addrP$, range$) range% = VAL(range$) 'Zero the teslameter on all ranges FOR i% = 0 TO 3 CALL gp3setrange(i%) CALL gpibout(gp3addrP$, "Z") SLEEP 3 'Allow time to finish NEXT i% 'Set the meter back to its original range CALL gp3setrange(range%) 'Message PRINT "The Hall probe is zeroed." END SUB