DECLARE SUB mtoolsethallrng () DECLARE SUB xyhcheckpar (ok$) DECLARE SUB xyhdatbvsxy (logfile$, i%, j%, xpos!, ypos!, b!) DECLARE SUB xyhpltbvsxy (logfile$, i%, j%, xpos!, ypos!, b!) DECLARE SUB mtoolgetbh (bhall!) DECLARE SUB mtoolmovexy (x!, y!) DECLARE SUB ls450setrange (r%) DECLARE SUB gp3setrange (r%) DECLARE SUB imaggeti (imag!) '**************************************************************************** 'Module XYMAPH 'This module makes an XY map of magnetic field strength using a Hall probe. ' 'Zachary Wolf '12/11/95 '**************************************************************************** 'Common area for shared parameters COMMON SHARED /xymaph/ datfileP$, pltfileP$, nyposP%, yposP!(), nxposP%, xposP!() SUB xyhbvsxy '**************************************************************************** 'This subroutine controls Hall probe measurements of B in two dimensions. ' 'Zachary Wolf '12/11/95 '**************************************************************************** 'Make sure required parameters have been defined CALL xyhcheckpar(ok$) IF ok$ <> "y" THEN PRINT "XYMAPH: parameter problem" EXIT SUB END IF 'Set the Hall probe range CALL mtoolsethallrng 'Message PRINT PRINT "Beginning the measurement cycle..." 'Loop over y positions FOR j% = 1 TO nyposP% 'Loop over x positions FOR i% = 1 TO nxposP% 'Move to the xy position CALL mtoolmovexy(xposP!(i%), yposP!(j%)) 'Measure the current, for the log file CALL imaggeti(imag!) 'Measure the field strength using the Hall probe CALL mtoolgetbh(bhall!) 'Write the results to the screen IF i% = 1 AND j% = 1 THEN CLS PRINT PRINT " XY Field Map" PRINT PRINT " Y X B " PRINT " (cm) (cm) (T) " PRINT "--------- --------- ---------" VIEW PRINT 7 TO 23 END IF PRINT USING "#####.###"; yposP!(j%); PRINT USING " #####.###"; xposP!(i%); PRINT USING " ##.######"; bhall! 'Write the field value to the dat file CALL xyhdatbvsxy(datfileP$, i%, j%, xposP!(i%), yposP!(j%), bhall!) 'Write the measurements to the plot file CALL xyhpltbvsxy(pltfileP$, i%, j%, xposP!(i%), yposP!(j%), bhall!) 'Allow run to end if there is a problem IF INKEY$ = CHR$(27) THEN GOTO loopexit 'End loop over x positions NEXT i% 'End loop over y positions NEXT j% loopexit: 'Move back to the home position CALL mtoolmovexy(0!, 0!) 'Reset the screen viewing area VIEW PRINT CLS END SUB SUB xyhcheckpar (ok$) '**************************************************************************** 'This subroutine checks that all required parameters have been assigned 'values. ' 'Output: ' ok$, "y" if parameter assignments are ok, "n" otherwise ' 'Zachary Wolf '9/18/95 '**************************************************************************** 'Default value ok$ = "n" 'datfileP$, pltfileP$ IF datfileP$ = "" OR pltfileP$ = "" THEN PRINT "XYMAPH: required file not defined" EXIT SUB END IF 'If we made it this far, all parameters have values ok$ = "y" END SUB SUB xyhdatbvsxy (logfile$, i%, j%, xpos!, ypos!, b!) '**************************************************************************** 'This subroutine writes a field measurement to the data file. ' 'Inputs: ' logfile$, name of data file ' i%, x index of the measurement position ' j%, y index of the measurement position ' xpos!, x position the measurement was taken at (cm) ' ypos!, y position the measurement was taken at (cm) ' b!, magnetic field strength (T) ' 'Zachary Wolf '12/11/95 '**************************************************************************** 'Save the number of times called STATIC ncall% ncall% = ncall% + 1 'Open the log file filenum% = FREEFILE OPEN logfile$ FOR APPEND AS filenum% 'Start a new page for a new series of measurements IF ncall% > 1 AND i% = 1 AND j% = 1 THEN PRINT #filenum%, CHR$(12) END IF 'Write a header on the first measurement of the series IF i% = 1 AND j% = 1 THEN PRINT #filenum%, PRINT #filenum%, "XY Field Map Measurements:" END IF 'Write the column titles whenever a new horizontal scan starts IF i% THEN PRINT #filenum%, PRINT #filenum%, " Ypos Xpos B " PRINT #filenum%, " (cm) (cm) (T) " PRINT #filenum%, "---------- ---------- ----------" END IF 'Write the values PRINT #filenum%, USING "#####.####"; ypos!; PRINT #filenum%, USING " #####.####"; xpos!; PRINT #filenum%, USING " ##.#######"; b! 'Close the log file CLOSE filenum% END SUB SUB xyhpltbvsxy (logfile$, i%, j%, xpos!, ypos!, b!) '**************************************************************************** 'This subroutine writes a field measurement to the plot file. ' 'Inputs: ' logfile$, name of data file ' i%, index for the x position ' j%, index for the y position ' xpos!, x position the measurement was taken at (cm) ' ypos!, y position the measurement was taken at (cm) ' b!, magnetic field strength (T) ' 'Zachary Wolf '12/11/95 '**************************************************************************** 'Save the number of times called STATIC ncall% ncall% = ncall% + 1 'Open the log file filenum% = FREEFILE OPEN logfile$ FOR APPEND AS filenum% 'Insert an empty line before a new series of measurements IF ncall% > 1 AND i% = 1 AND j% = 1 THEN PRINT #filenum%, END IF 'Write a header when a set of measurements begins IF i% = 1 AND j% = 1 THEN PRINT #filenum%, ";y(cm), x(cm), B(T)" END IF 'Write the values PRINT #filenum%, USING "#####.####"; ypos!; PRINT #filenum%, USING " #####.####"; xpos!; PRINT #filenum%, USING " ##.#######"; b! 'Close the log file CLOSE filenum% END SUB SUB xyhsetpar (datfile$, pltfile$, nypos%, ypos!(), nxpos%, xpos!()) '**************************************************************************** 'This subroutine sets the parameters for the XY mapping module. ' 'Input: ' datfile$, name of the data file ' pltfile$, name of the plot file ' nypos%, number of y positions to make measurements at ' ypos!(1 to nypos%), the y positions to make measurements at ' nxpos%, number of x positions to make measurements at ' xpos!(1 to nxpos%), the x positions to make measurements at ' 'Zachary Wolf '12/11/95 '**************************************************************************** 'Save the parameters in a common block for future use datfileP$ = datfile$ pltfileP$ = pltfile$ nyposP% = nypos% DIM yposP!(1 TO nyposP%) FOR i% = 1 TO nyposP% yposP!(i%) = ypos!(i%) NEXT i% nxposP% = nxpos% DIM xposP!(1 TO nxposP%) FOR i% = 1 TO nxposP% xposP!(i%) = xpos!(i%) NEXT i% END SUB