DECLARE SUB muxlogsetchan (logfile$, chan$) DECLARE SUB muxcheckpar (ok$) DECLARE SUB k7011closecc (card%, chan%) DECLARE SUB k7011openall () '**************************************************************************** 'Module MUXCOIL.BAS ' 'These subroutines control the coil connections to the integrator. ' 'Zachary Wolf '10/25/96 '**************************************************************************** 'Put the required parameters for this module in a common block COMMON SHARED /muxcoil/ logfileP$, maincoilmxchanP%, dpolcoilmxchanP%, qpolcoilmxchanP%, dbuckmxchanP%, qbuckmxchanP%, dqbuckmxchanP% 'Semi-permanent parameters CONST cardP% = 1 'K7011 multiplexer card number SUB muxcheckpar (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" 'Files IF logfileP$ = "" THEN PRINT "MUXCOIL: required file not defined" EXIT SUB END IF 'Channel numbers IF maincoilmxchanP% <= 0 OR dpolcoilmxchanP% <= 0 OR qpolcoilmxchanP% <= 0 OR dbuckmxchanP% <= 0 OR qbuckmxchanP% <= 0 OR dqbuckmxchanP% <= 0 THEN PRINT "MUXCOIL: illegal channel number" EXIT SUB END IF 'If we made it this far, all parameters have values ok$ = "y" END SUB SUB muxlogsetchan (logfile$, chan$) '**************************************************************************** 'This subroutine logs a multiplexer channel closure. ' 'Input: ' logfile$, the name of the log file ' chan$, multiplexer channel description ' 'Zachary Wolf '10/29/96 '**************************************************************************** 'Open the log file filenum% = FREEFILE OPEN logfile$ FOR APPEND AS filenum% 'Print the results PRINT #filenum%, TIME$; " Multiplexer Channel Closure:" PRINT #filenum%, " Channel Description = "; chan$ 'Close the log file CLOSE filenum% END SUB SUB muxopenall '**************************************************************************** 'This subroutine opens all multiplexer channels. ' 'Zachary Wolf '10/28/96 '**************************************************************************** 'Make sure all parameters have been defined with acceptable values CALL muxcheckpar(ok$) IF ok$ <> "y" THEN EXIT SUB 'First open any channels which are presently closed CALL k7011openall END SUB SUB muxsetchan (chan$) '**************************************************************************** 'This subroutine first opens all multiplexer channels. It then closes 'the channel corresponding to the given coil description. ' 'Input: ' chan$, description of which coil to connect to the integrator ' The options for chan$ are "main", "dipole", "quadrupole", ' "dbuck", "qbuck", "dqbuck" ' 'Zachary Wolf '10/25/96 '**************************************************************************** 'Make sure all parameters have been defined with acceptable values CALL muxcheckpar(ok$) IF ok$ <> "y" THEN EXIT SUB 'First open any channels which are presently closed CALL k7011openall 'Close the desired channel IF chan$ = "main" THEN CALL k7011closecc(cardP%, maincoilmxchanP%) ELSEIF chan$ = "dipole" THEN CALL k7011closecc(cardP%, dpolcoilmxchanP%) ELSEIF chan$ = "quadrupole" THEN CALL k7011closecc(cardP%, qpolcoilmxchanP%) ELSEIF chan$ = "dbuck" THEN CALL k7011closecc(cardP%, dbuckmxchanP%) ELSEIF chan$ = "qbuck" THEN CALL k7011closecc(cardP%, qbuckmxchanP%) ELSEIF chan$ = "dqbuck" THEN CALL k7011closecc(cardP%, dqbuckmxchanP%) ELSE PRINT "Unknown coil multiplexer channel." END IF 'Log the channel closure CALL muxlogsetchan(logfileP$, chan$) END SUB SUB muxsetpar (logfile$, maincoilmxchan%, dpolcoilmxchan%, qpolcoilmxchan%, dbuckmxchan%, qbuckmxchan%, dqbuckmxchan%) '**************************************************************************** 'This subroutine sets the parameters required by this module. ' 'Input: 'logfile$, path and name of the log file 'maincoilmxchan%, main coil multiplexer channel 'dpolcoilmxchan%, dipole coil multiplexer channel 'qpolcoilmxchan%, quadrupole coil multiplexer channel 'dbuckmxchan%, main + dipole bucking multiplexer channel 'qbuckmxchan%, main + quadrupole bucking multiplexer channel 'dqbuckmxchan%, main + dipole + quadrupole bucking multiplexer channel ' 'Zachary Wolf '10/25/96 '**************************************************************************** 'Set the parameters logfileP$ = logfile$ maincoilmxchanP% = maincoilmxchan% dpolcoilmxchanP% = dpolcoilmxchan% qpolcoilmxchanP% = qpolcoilmxchan% dbuckmxchanP% = dbuckmxchan% qbuckmxchanP% = qbuckmxchan% dqbuckmxchanP% = dqbuckmxchan% END SUB