SDSS Instruments or "SDSS Instrumentation at JHU" -> Spectrographs -> Mechanicals ->
SpecMech Commands Manual
All commands consist of a single letter followed by arguments, if any. The commands are as follows, where <a|b|c> means pick any one of a, b or c:
- ? - help: returns this list
- An - Alter the exposure time to n sec; fails if no exposure
- c<s|l|r|b> - close shutter or left/right/both Hartmann screens; note: closing one Hartmann screen opens the other
- en - expose for n sec; fails if currently exposing; if an exposure is paused, it's time is recorded in Last_exp.time
- I - initialize the spechMech controller
- ln - left focus (open left Hartmann door and expose) for n seconds
- m<a|b|c>n - move motor a, b or c by n relative ticks (probably 50μm each)
- o<s|l|r|b> - open shutter or left/right/both Hartmann screens; note: opening one Hartmann screen closes the other
- P - Pause the current exposure; closes the shutter but leaves the Hartmann screens alone; fails if no current exposure
- pn - piston the collimator mirror by n relative ticks (probably 50μm each)
- R - Resume exposure paused with P; fails if no paused exposure
- rn - right focus (open right Hartmann door and expose) for n seconds
- S - Stop an exposure, if present, closing the shutter and Hartmann screens; the exposure's time is recorded in Last_exp.time
- s - status
- z - set motor positions to zero
Obsolete Commands:
- dyyyymmddhhmmss - no-op (was set date)
- i - no-op (was interactive mode)
- n - no-op (was non-interactive mode)
Output from the status command is as follows, where every line is a keyword followed by a value:
| Keyword | Description of Value |
| spMechVersion | the CVS tag for this version of specMech; a string |
| Bootup | boot time, in seconds, an int; meaningless because the controller's clock is never set |
| SpectroID | 0 for SP1, 1 for SP2 |
| SlitID | ID of current slithead, an integer |
| Air | On or Off |
| Shutter_open_sensor | On or Off |
| Shutter_closed_sensor | On or Off |
| Left_open_sensor | On or Off |
| Left_closed_sensor | On or Off |
| Right_open_sensor | On or Off |
| Right_closed_sensor | On or Off |
| Coll_motor_A | position of collimator motor A, in ticks. Tick size is probably 50μm. Position is shown as 999999999 if unknown. |
| Coll_motor_B | position of collimator motor B, in ticks |
| Coll_motor_C | position of collimator motor C, in ticks |
| Requested_exp.time | requested exposure time for current exposure, in sec; 0 if no exposure |
| Exp_time_left | time remaining on the exposure, in sec; 0 if no exposure |
| Last_exp.time | time of the last exposure, in sec |
| Exp_state | None, Paused or Exposing |
| Shutter_open_transit | the time it took for the shutter to last open, in sec |
| Shutter_close_transit | the time it took for the shutter to last close, in sec |
| Coll_motor_A_status | status of collimation motor A. Motor status is 0xFF if unknown. |
| Coll_motor_B_status | status of collimation motor B |
| Coll_motor_C_status | status of collimation motor C |
Note: all times are initialized to 0.
Collimation motor status is an 8 bit word displayed in hex word with a prefix of 0x. The bits are as follows:
| Bit | Name | Description of Bit |
| 0 | On Target | Set if the motor position error goes to exactly zero. Do not expect this to happen; small errors are normal. Cleared by position error going above 127 or by any move command. |
| 1 | Limit Switch | Set if a limit switch has been hit. Cleared by the next move command. |
| 2 | Motor Off | Set if the motor is off, cleared if the motor is on |
| 3 | Slew Mode | "Motor is driven by Pushbutton keyboard or joystick", whatever that means |
| 4 | not used | not used |
| 5 | Slave | Set if in slave mode |
| 6 | Find Edge | Set if in find edge mode |
| 7 | Stopped | Set if the motor stops for more than 128ms |
- Each command must be on its own line.
- Exposure times are in decimal seconds, but the decimal point is optional.
- White space between the command letter and arguments is allowed but not required.
- All commands are echoed, including a terminating \r\n
- If a command outputs data (and very few do), the data follows the echoed command.
- If the command generates an error, a one line error message is output as follows:
failed { description of error }\r\n
- After everything else, a terminating OK\r\n is output. This indicates that specMech is ready to process another command.
- Commands are sent over an RS232 serial line at 9600 baud with CTS/RTS hardware flow control, 8 data bits, 1 stop bit, no parity.
2002-10-17 v2_5_0 R. Owen
- Appended several items to the status output, as per PR 4256 and negotiation with Eric Neilsen: Exp_state, Shutter_open_transit, Shutter_close_transit, Coll_motor_A_status, Coll_motor_B_status and Coll_motor_C_status.
- Added a section to the manual documenting the output of the status command.
- 2002-10-23: added a description of motor status and a guess at motor tick size to the manual.
2002-09-25 v2_4_0 R. Owen
- Fixed the bug that caused the help command to fail.
- Improved exposure timing. The exposure is now considered to start halfway between when the shutter closed sensor goes off and the shutter open sensor goes on, and similarly for the exposure end time. One side effect is that the shutter will start to close some time before the listed Exp_time_left.
- The (A)lter command can now alter paused exposures; formerly this was an error (oops).
- The (e)xpose command will now terminate a paused exposure first, if present. Formerly this was an error.
- Exposure times may be expressed in decimal seconds (but the decimal point is optional) and are displayed to 1/10ths of a second.
- Increased the shutter motion time limit from 5 seconds to 10 and the Hartmann screen motion time limit from 2 seconds to 5. This should increase reliability in cold weather.
- Removed all use of the LCD except to display the startup message. Thus there is now no display of the operating command nor of an exposure countdown.
- Changed the beeper to act primarily as shutter state feedback. The new patterns are:
- "...." when the shutter finishes opening.
- "- -" when the shutter finishes closing.
- "... --- ..." (SOS in Morse Code) if shutter or Hartmann motion times out (this is no change).
- The same old pattern at startup.
- Internally I overhauled the timing code to use the MS_TIMER counter, eliminated the exposure countdown task and made all serial port writes time limited.
2002-07-18 v2_2_0 R. Owen
Major overhaul. Notable changes include:
- Commands are echoed.
- If a command fails, an error message is printed and the rest of the line is ignored.
- Multiple commands may not be combined on one line.
- The (i)nteractive and (n)on-interactive commands are now no-ops. There is only one mode.
- Some command are rejected with an error message if not in the correct state (current exposure, paused exposure or no exposure). These include (A)bort, (e)xpose, (P)ause and (R)esume. Formerly some of these commands silently did strange things when specMech was in the wrong state. Note that (S)top is always safe and is the proper way to make sure that specMech is not exposing.
- The status line Last_exp.time now always indicates the time of the most recently completed exposure. Formerly it was 0.0 if an exposure was in progress.
- Added the (I)nitialize command.
2001-02-14 Jon Brinkmann
- Fixed reporting format for spMechVersion so it reports the version number without "$Name: $".
- Fixed bugs in cmd_s, cmd_S, exposure_start and exposure_countdown.
2001-02-06 Jon Brinkmann
- Fixed exposure control routines so that exposures can be altered, paused and resumed.
- More cleanup and documenting.
2001-01-29 Jon Brinkmann
- Removed fan and temperature code.
- Added Spectrograph ID.
- Did lots of documentation and cleaning up.
- Added conditional code so that the code can be debugged under UNIX using the command:
gcc -c -o /dev/null -Wall -DUNIX_DEBUG specMech.c
2000-07-14 Jon Brinkmann
Alan Uomoto wrote the original specMech code. I don't have a change log for his versions.
Alan Uomoto wrote the initial specMech code. Jon Brinkmann made many improvements (such as the ability to pause exposures) and continues to help maintain the code.
Thanks to Eric Neilsen for his willingness to adapt SOP to my modifications of the specMech code and to Craig Loomis for his help debugging a nasty problem.
SpecMech Version: $Name: v2_5_0 $