Stepper motors are used to move the secondary mirror, heterodyne receiver optics and instrument rotators at the Cassegrain focus. These motors are connected to either one of three stepper motor controllers (SMCs) called SMC1, SMC2 and SMC3. (They are actually VMEbus DSP modules with four or five stepper motor interface cards and one serial communication card.) These controllers are located at the bottom of the Sidecab rack and connected to the antenna computer in the AOS room by asynchronous serial lines.
Stepper motors are usually controlled by the telescope control software (TCS). However, you sometimes have to control them manually. There are several ways to communicate with the SMCs; you can connect a dumb terminal or PC running any terminal emulation software directly to SMCs' serial port (9600 bps, 8 bits, 1 stop, no parity, no flow control), or you can use kermit from the antenna computer (with the same communication parameter, kermit to /dev/sio4, /dev/sio5 and /dev/sio6 for SMC1, SMC2 and SMC3, respectively). The preferred way, however, is to use a program called smc, which are explained below in detail.
Note that UIP macros SMC1, SMC2 and SMC3 do not work yet.
Once you logged on to the antenna computer, SMCs can be controlled directly by a program called smc. It resides in /usr/local/cso/bin, which should be accessible by default. It takes a SMC number (1, 2 or 3) as its (only) command line argument. For example, type:
hau$ smc 1
to control SMC1. There are three shell scripts, smc1, smc2 and smc3, for your convenience.
To make common tasks easier, there are several other shell scripts. For example, you can use the shell script secondary.home to home the secondary mirror as:
hau$ secondary.home
instead of running the smc program (or the smc3 shell script) and typing several commands manually.
The program smc and all the SMC shell scripts can in principle be used while the TCS is running. However, the result is not always safe or predictable if commands from more than one program are interleaved. For example, you do not want to reset the SMC3 when the TCS is trying to adjust the secondary mirror focus. On the other hand, it is probably safe to play with the SMC1 and SMC2 if the TCS is not trying to switch from one heterodyne reciever to another (i.e. if you do not issue the LO command from the UIP). It is necessary to reload the antenna computer once you reset the SMCs and homed the motors.
There are only several commands you usually have to use: reset, load, home, send and exit. Here is a brief description of these commands:
The reset command resets the SMC and communication parameters by software. If this command hangs, you have to ^C-out and restart the smc program, then issue the reset command again. If it still hangs, you probably have to power-cycle the SMCs.
The load command loads all the necessary macros to the SMC. You have to issue this command after the reset command.
The home command homes one of the motors if you give the motor number (1, 2, ...) as an argument (e.g. home 2), or homes all the motors (see note about homing the instrument rotators) if you type home all. Homing stepper motors may take a few minutes. You should hear funky sound while motors are being homed.
The send command takes a double-quoted string ("...") as its argument, sends it to the SMC, and prints the response if any. The following three forms are most commonly used: send "ts", send "tp", and send "to", to print the status information (like homed, busy, etc.), absolute position, and encoder reading of all the motors active, respectively.
The exit command terminate the smc program gracefully. It closes the serial device and releases the mutex (explained below) if it is locked. Note that the interrupt handler for ^C also invokes the same cleanup routines.
In addition, lock and unlock commands are useful. The lock command locks the mutex and the unlock command unlocks the mutex. Operations guarded by these commands are guaranteed to be atomic. Note that each command or each access to the SMC is guaranteed to be atomic without the use of lock and unlock.
Here is the list of SMC-related shell scripts currently available:
To home the secondary mirror's focus, vertical, horizontal and rotary motors, log on to the antenna computer and run the shell script secondary.home:
hau$ secondary.home Opening SMC3... done Resetting SMC3... done Loading macros to SMC3... done Homing motor #1 of SMC3... done Homing motor #2 of SMC3... done Homing motor #3 of SMC3... done Homing motor #4 of SMC3... done ...snip... hau$
Or, alternatively, you can use the shell script smc3 and issue commands as explained below. Note that you have to type only the letters shown like this:
hau$ smc3 Opening SMC3... done smc3> reset // see note below Resetting SMC3... done smc3> load // see note below Loading macros to SMC3... done smc3> home all // all motors Homing motor #1 of SMC3... done Homing motor #2 of SMC3... done Homing motor #3 of SMC3... done Homing motor #4 of SMC3... done smc3> status Motor 1: status = 74 = armed complete homed Motor 2: status = 74 = armed complete homed Motor 3: status = 74 = armed complete homed Motor 4: status = 74 = armed complete homed smc3> exit hau$
Note that the reset and load commands are optional. If you reset the controller, however, it is mandatory to load macros.
To home the Sidecab receiver optics (the fourth mirror's linear and rotary motors, the fifth mirror's vertical, horizontal and rotary motors, and two receiver dewars' focus), log on to the antenna computer and run the shell script sidecab.home:
hau$ sidecab.home Opening SMC2... done Resetting SMC2... done Loading macros to SMC2... done Homing motor #1 of SMC2... done Homing motor #2 of SMC2... done Homing motor #3 of SMC2... done Homing motor #4 of SMC2... done Homing motor #5 of SMC2... done ...snip... Opening SMC1... done Resetting SMC1... done Loading macros to SMC1... done Homing motor #1 of SMC1... done Homing motor #2 of SMC1... done ...snip... hau$
Or, alternatively, you can use the shell script smc2 and smc1 and issue commands as explained below. Note that you have to type only the letters shown like this:
hau$ smc2 Opening SMC2... done smc2> home all // all motors Homing motor #1 of SMC2... done Homing motor #2 of SMC2... done Homing motor #3 of SMC2... done Homing motor #4 of SMC2... done Homing motor #5 of SMC2... done smc2> status Motor 1: status = 90 = armed complete negative homed Motor 2: status = 90 = armed complete negative homed Motor 3: status = 90 = armed complete negative homed Motor 4: status = 74 = armed complete homed Motor 5: status = 90 = armed complete negative homed smc2> exit hau$ smc1 Opening SMC1... done smc1> home all // motor #1 & motor #2 Homing motor #1 of SMC1... done Homing motor #2 of SMC1... done smc1> status Motor 1: status = 74 = armed complete homed Motor 2: status = 74 = armed complete homed Motor 3: status = 10 = armed complete Motor 4: status = 10 = armed complete smc1> exit hau$
Like the SMC3, resetting and loading macros are optional (not shown above). Note that it is very important that you home the SMC2 first. Otherwise, you might rotate the fifth mirror (motor 2 of the SMC1) into the local chains and bust them. Homing the SMC2 first insures that both the receiver dewars are at the safe position, away enough from the fifth mirror.
We have a new VMEbus enclosure for the SMCs (we stole it from SMA). A power switch is now on the front panel, at the bottom-right corner.
You should wait for at least ten seconds before you turn the power back on. You have to reset, load macros and home all the motors for all the SMCs after cycling the power.