DECLARE SUB hp3457ctc (c%, tc!) DECLARE SUB k7011closecc (card%, chan%) DECLARE SUB k7011openall () DECLARE SUB tmaglogtn (logfile$, n%, tn!) '**************************************************************************** 'Module TMAG 'This module contains drivers to measure magnet temperatures. ' 'Zachary Wolf '1/5/95 '**************************************************************************** 'Include the parameters used in the module REM $INCLUDE: 'param.inc' 'Required parameters 'Temperature measurement parameters 'CONST mxhpchanP% = 4 'HP3457 channel for the multiplexer 'CONST mxcardP% = 1 'K7011 card number 'CONST t1mxchanP% = 12 'K7011 T1 channel 'CONST t1P$ = "Water In" 'CONST t2mxchanP% = 13 'K7011 T2 channel 'CONST t2P$ = "Water Out" 'CONST t3mxchanP% = 14 'K7011 T3 channel 'CONST t3P$ = "Magnet Iron" 'CONST t4mxchanP% = 15 'K7011 T4 channel 'CONST t4P$ = "Magnet Coil" 'CONST t5mxchanP% = 31 'K7011 T5 channel 'CONST t5P$ = "Ambient" 'Make file names common to all procedures 'COMMON SHARED /filenames/ logfileP$, rawfileP$, rtdatP$, sldatP$, slpltP$, hardatP$, harpltP$ SUB tmaggettn (n%, tn!) '**************************************************************************** 'This subroutine gets a magnet temperature. ' 'Input: ' n%, identifier giving which temperature to measure ' 'Output: ' tn!, the measured magnet temperature ' 'Zachary Wolf '1/5/95 '**************************************************************************** 'Determine which multiplexer channel to use IF n% = 1 THEN c% = t1mxchanP% ELSEIF n% = 2 THEN c% = t2mxchanP% ELSEIF n% = 3 THEN c% = t3mxchanP% ELSEIF n% = 4 THEN c% = t4mxchanP% ELSEIF n% = 5 THEN c% = t5mxchanP% ELSE PRINT "TMAGGETTN: Unknown temperature requested." tn! = 0! EXIT SUB END IF 'Measure Tn CALL k7011closecc(mxcardP%, c%) 'close the multiplexer channel CALL hp3457ctc(mxhpchanP%, tn!) 'read the temperature CALL k7011openall 'open all multiplexer channels 'Log the result CALL tmaglogtn(logfileP$, n%, tn!) END SUB SUB tmaglogtn (logfile$, n%, tn!) '**************************************************************************** 'This subroutine writes a magnet temperature to the log file. ' 'Input: ' logfile$, the name of the log file ' n%, identifier giving which temperature ' tn!, the measured temperature ' 'Zachary Wolf '1/5/95 '**************************************************************************** 'Open the log file filenum% = FREEFILE OPEN logfile$ FOR APPEND AS filenum% 'Print the results PRINT #filenum%, PRINT #filenum%, TIME$; " Temperature: Channel "; n%; ", T = "; tn!; " deg C" 'Close the log file CLOSE filenum% END SUB