/* Copyright  2002 Monterey Bay Aquarium Research Institute.               */

Shutter Command Description 
-------------------------------------------------------------------------------
Command: OPEN

Description

This command will attempt to open the shutter to the software stop.

Possible Errors

ERR XX06 - The shutter was halted by a received character.
ERR XX09 - Shutter velocity too low.
ERR XX0A - Shutter not homed.
ERR XX0B - The software stop position for the shutter is corrupt or has not been set.

-------------------------------------------------------------------------------
Command: CLOSE

Description

This command will attempt to close the shutter.

Possible Errors

ERR XX06 - The shutter was halted by a received character.
ERR XX09 - Shutter velocity too low.

-------------------------------------------------------------------------------
Command: MOVE XXXX

Description

This command will attempt to make a relative move defined by the XXXX parameter.

Possible Errors

ERR XX04 - The parameter for the MOVE command was missing.
ERR XX05 - The parameter for the MOVE command was out of range.
ERR XX09 - Shutter velocity too low.
ERR XX06 - The shutter was halted by a received character.
ERR XX07 - The shutter reached a physical limit before the move was completed.
ERR XX08 - The shutter reached a physical limit before the move was completed.

-------------------------------------------------------------------------------
Command: SET_STOP [XXXX]

Description

This command will set the open position of the shutter using the parameter provided.  If no parameter is provided the current position will be used.

Possible Errors

ERR XX0A - Shutter not homed.
ERR XX05 - The parameter for the SET_STOP command was out of range.

-------------------------------------------------------------------------------
Command: GET_STOP

Description

This command will return the software stop position of the shutter.

Possible Errors

ERR XX0B - The software stop position for the shutter is corrupt or has not been set.

-------------------------------------------------------------------------------
Command: JOG_O

Description

This command will move the shutter in the open direction until a character is sent to the shutter or a physical limit is reached.

Possible Errors

ERR XX09 - Shutter velocity too low.
ERR XX06 - The shutter was halted by a received character.
ERR XX07 - The shutter reached a physical limit before the move was completed.
ERR XX08 - The shutter reached a physical limit before the move was completed.

-------------------------------------------------------------------------------
Command: JOG_C

Description

This command will move the shutter in the closed direction until a character is sent to the shutter or a physical limit is reached.

Possible Errors

ERR XX09 - Shutter velocity too low.
ERR XX06 - The shutter was halted by a received character.
ERR XX07 - The shutter reached a physical limit before the move was completed.
ERR XX08 - The shutter reached a physical limit before the move was completed.

-------------------------------------------------------------------------------
Command: GET_POS

Description

This command will return the current position of the shutter.

Possible Errors

ERR XX0A - Shutter not homed.

-------------------------------------------------------------------------------
Command: GET_STAT

Description

This command will return the state of all the shutter inputs as a hex-ASCII value.  The only inputs to date are

water alarm     0x01
open sensor     0x02
close sensor    0x04
shutter homed   0x08

Possible Errors

-------------------------------------------------------------------------------
Command: ECHO

Description

This command will cause all characters sent to the shutter to be echoed back and append a line feed to all carriage returns returned by the shutter.  If the shutter is already in echo mode this command will toggle the shutter back to non-echo mode.  The shutter will always power up in non-echo mode.


Possible Errors

-------------------------------------------------------------------------------

Others Errors

ERR XX01 - Unknown command


Error Code Description
-------------------------------------------------------------------------------
If a shutter command is executed successfully the shutter will return the characters "RDY" followed by a carriage return.  When a shutter command fails the error code format for the shutter is as follows

ERR [flags][error type]<CR>
RDY<CR>

The characters "ERR" will be followed by a space and four more characters that represent hex-ASCII numbers and then by a carriage return.  After the error code has been issued the shutter will issue the "RDY" prompt indicating that it is ready to process another command.  

The first two hex-ASCII numbers form the flags field of the error code which can contain up to eight different status flags.  The following status flags have been defined

water alarm     0x01
open sensor     0x02
close sensor    0x04
shutter homed   0x08

The latter two hex-ASCII numbers represent an error type.  There are 255 possible error types not including error zero.  The following error types have been defined


no command match                     0x01

parameter was not a number           0x02
command had too many characters      0x03
command requires parameter           0x04
parameter out of range               0x05

move halted by received character    0x06
move halted due to hall sensor 1     0x07
move halted due to hall sensor 2     0x08
move halted due to low velocity      0x09

shutter not homed                    0x0A

software stop in eeprom was corrupt  0x0B


An error code may be returned if an error is encountered or a water alarm occurs.  The following are some examples of error codes that could be returned by the shutter.

ERR 0100

This error code would be returned if the command was executed successfully but a water alarm was detected.

ERR 0001

This error code would be returned if the no command match was found.

ERR 030A

This error code would indicate that the open sensor input is asserted there is a water alarm and the shutter is not homed.


A note on position parameter units
-------------------------------------------------------------------------------

Position parameter units will be the percentage of the shutter's fully open position times ten.  For example if you wanted to use the MOVE command move to move the shutter 30% of it open value from its current position in the open direction you would issue 

MOVE 300

If you would like to move the shutter 70% of its open value but in the closed direction you would send the shutter

MOVE -700

It should also be noted that a space between the sign and the number will generate an error.

This gives you the ability to move the shutter in 0.1% steps of its total open value.  So if the total open value is 8 inches you could move the shutter .008 inch steps with the move command.  Any commands that return position will also use this convention.


