Skip to main content

Serial Protocol Command: Engine Control

Posted in

Command: Engine Control

 

The Engine Control command provides access to commands that control the operation of the engine, or report current status of the engine.  Each Engine Control command will use the command byte value of '1'.  The following table lists each sub-command:

NameData LengthSub.Com (DB1)DB2DB3DB4DB5Info
noop10n/a   

Non-operative, always returns true. Used for checking to see if the engine is awake and ready for a command.

start11n/a   Start the current program,or resume from pause.
pause12n/a   Pause program execution.
stop13n/a   Stop the current program, moved steps, time spent, shots fired and other statistics are reset.
camera enable14n/a   Enable the camera for use
camera disable15n/a   Disable the camera for use
move motor now56motor #directionsteps (unsigned int)Move the given motor the specified number of steps. (Blocking)
send motor home27motor #    Send the given motor to its home position. (Blocking)
fire camera now58exposure time - ms (unsigned long) Expose the camera immediately. (Non-Blocking)
motor sleep line29on/off    Enable or disable the motor sleep line.  This causes the motor sleep pin to be brought low between movements to reduce power consumption.
min step delay310microseconds (unsigned int)  Set minimum delay between motor steps.
max step delay311microseconds (unsigned int)  Set maximum delay between motor steps. 
down ramp now 12motor #   Execute a down ramp on the given motor now (used outside of actions/keyframes) 
exposure action mod313divisor (unsigned int)  Divide the value specified in any exposure multiplication action by this value.  This is how you would decrease or increase exposure time in fractions of a whole. 
current statusvaries100status value   Get value of different operating parameters.  See documentation on status values below.

 

Examples

 

Send a start command to the engine:

Command ByteData Length ByteSub-Com (DB1)
111

 

Send motor #2 home:

Command ByteData Length ByteSub-Com (DB1)Data Byte 2
1272

 

Sub-command: Current Status

 

The Current Status sub-command allows one to retrieve a number of details about the current state of the engine.  Each request must include a parameter which one is requesting the value of.  The parameter is a single-byte integer which is sent as the second data byte in the command.  All current status requests will respond with at least one byte of data when the request is successful.

The following table lists all parameter values:

NameParameter Value (DB2)DB3ReturnsInfo
api version0n/abyteReturns current API version #
running status1n/abyteReturns 0 if engine stopped/paused, or 1 if engine currently running
run time2n/aunsigned longReturns current program run time, in ms
camera status3n/abyteReturns 0 if camera disabled, 1 if camera enabled
shot count4n/aunsigned longReturns count of shots fired in currently running program
interval time5n/aunsigned intReturns currently set interval time
exposure time6n/aunsigned longReturns currently set exposure time, in ms
post time7n/aunsigned intReturns currently set post-exposure delay time, in ms
currently exposing8n/abyteReturns 1 if camera is currently exposing, 0 if not
motor enabled9motor #byteReturns 1 if given motor is enabled, 0 if not
motor dir10motor #byteReturns direction set for given motor
motor steps moved11motor #unsigned longReturns # of steps moved by motor in current program
motor dist from home12motor #signed longReturns distance from home (negative if in 0 direction, positive if in 1 direction)
reserved13   
motor max step14motor #unsigned longReturns max steps setting for the given motor
motor ramp15motor #byteReturns motor ramp value for the given motor
motor backlash16motor #byteReturns motor backlash comp. amount for given motor
motor steps17motor #unsigned intReturns # of steps between shots for the given motor
camera keyframe18keyframe indexunsigned longReturns keyframe value at given index
time keyframe19keyframe indexunsigned longReturns keyframe value at given index
motor keyframe20keyframe indexunsigned longReturns keyframe value at given index
action21action indexunsigned longReturns action value at given index

Some status requests are only meaningful if the program is started or paused, such as shots fired and run time.  

Ensure that you pay close attention to the response type, and its sign!

 

Examples

 

Request the current exposure time setting:

Command ByteData Length ByteSub-Com (DB1)Parameter (DB2)
121006

Response from Engine:

Response Value ByteData Length ByteDB1DB2DB3DB4
14exposure time (unsigned long)