Skip to main content

Serial Protocol Command: Set Program Information

Posted in

Command: Set Program Information

 

The Set Program Information command allows you to control the different parameters that are used during the running of a program.  This is essentially how a time-lapse or similar program is created.  You set the different parameters controlling how your program will operate, and then start the execution of the program.  Every value is read immediately before it is used by the engine, so you are able to modify parameters on the fly, and have them take effect the next time that value would be used.

Each Program Information command will use the command byte value of 2.

The set program information provides a number of sub-commands, grouping parameters by type.  The following table lists each sub-command:

NameSub-Command (DB1)Info
camera1 Set camera parameters
motor2 Set motor parameters
action3 Add/Remove actions
keyframe4 Add/Remove keyframes

When specifying a sub-command, you must also specify which parameter you want to modify as a next byte, the sections below detail each sub-command, and the available parameters.

No Set Program Information command returns any data, only a positive response with zero data bytes will be returned for any set program info command.

Sub-command: Camera

 

The Camera sub-command allows you to control all camera parameters.  The following parameters are supported:

NameData Length ByteSub-Com (DB1)Param (DB2)DB3DB4DB5DB6Info
interval411interval (unsigned int)  Sets the interval between camera shots
exposure time612exposure tm (unsigned long)Sets exposure time in milliseconds
pre-focus tap time413tap tm (unsigned int)  Set amount of time to bring focus pin high before firing camera (0 to disable focus tap)
max shots414shot count (unsigned int)  Set maximum number of exposures to take during program
post delay time415delay tm (unsigned int)  Set amount of time to delay after completing exposure, and before moving motors
focus with shutter316on/off (1 or 0)   Set whether to always bring focus pin high with shutter pin -- 0 to disable, 1 to enable.
camera cycle repeat count317count   Set repeat cycle (see documentation) count
camera cycle add repeat action418cycle action index (0-3)action id (0-15)  Add an action to be called between each repeat shot in a repeat cycle
camera cycle add complete action419complete action index (0-3)action id (0-15)  Add an action to be called at the completion of a camera repeat cycle
camera cycle return motors home upon cycle complete3110on/off (1 or 0)   Set whether or not to send all motors back to the point where they were at the beginning of a repeat cycle.

 

For more information on the camera repeat cycle functions, see the Cycle Repeat documentation.

 

Example:

Set intervalometer:

Command ByteData Length ByteSub-Com (DB1)Parameter (DB2)DB3DB4
2411interval sec. (unsigned int)

 

Sub-command: Motor

The Motor sub-command allows you to control all motor parameters.

Each parameter requires a motor number to apply the parameter to.  Valid motor numbers are 0-3.  You may change any parameter while a program is running, e.g. you could set up each axis initially, and only turn them on as needed during the course of executing your program.

The following parameters are supported:

 

NameData Length ByteSub-Com (DB1)Param (DB2)DB3DB4DB5DB6DB7Info
steps421motor #steps (unsigned int)  Set # of steps between camera shots for the given motor
ramp rate422motor #ramp rate   Set # of exposures to ramp up to full speed/down to stop for the given motor
direction423motor #dir (0 or 1)   Set the direction of travel for the given motor
max steps724motor #steps (unsigned long)Set the maximum number of steps to travel in the program for the given motor
enable325motor #    Enable the given motor
disable326motor #    Disable the given motor
set home327motor #    Set current position as 'home' for the given motor
backlash comp428motor #steps   Set the number of steps of backlash to compensate for, for the given motor

 

Example:

Set ramp rate for motor #0:

Command ByteData Length ByteSub-Com (DB1)Parameter (DB2)DB3
121002ramp rate (byte)

 

Sub-command: Action

 

The Action sub-command allows you to create and remove actions for use by keyframes or in a repeat shot cycle. Up to sixteen total actions may be stored, each specified by an index value (0-15).  You may, at any time, over-write any existing action, or remove it to prevent it from being called again in the future.  

Actions can change parameters, or control program execution. There are four basic action controls:

NameControl (DB2)Info
camera1Changes parameters related to camera control
motor2Changes parameters related to motor control
program3Changes program execution
delete4Deletes an action from memory

Each action control will be followed by a single byte, specifying the action index to write to/delete.  The legal values for an action index are 0-15.

Each action request should begin with the following 5-byte sequence:

Command ByteData Length ByteSub-Com (DB1)Control (DB2)Action Index (DB3)
2length3control
index

length, control, and index will vary with each action command.

 

Camera Control Action

When creating a camera control action, you can choose which camera setting you want to change.  The setting to change is defined by the 'type' parameter, that is specified in the 4th data byte. The following table details which controls are available, and the data to send from the data length byte:

NameDLBSub-Com (DB1)Cntrl (DB2)IDX (DB3)Type (DB4)DB5DB6Info
enable631index1interval (unsigned int)Enables the camera and sets the interval time. (Interval time is optional, if 0 the interval is unchanged)
disable431index2  Disables the camera
exposure tm631index3exp tm (unsigned int)Sets exposure time to given amount of milliseconds
exposure mult.631index4multiplier (unsigned int)Multiplies exposure time by multiplier

 

Example:

Set Action Index #0 to set exposure time for camera

Command ByteData Length ByteSub-Com (DB1)Control (DB2)Action Index (DB3)Type (DB4)DB5DB6
263103exposure tm (unsigned int)

 

Motor Control Action

 

Motor control actions all require a motor number, enable/disable flag, direction, and command.  This means that you may, in a single action, enable a motor, set direction, and change an operating parameter for a motor. The following table lists each command and its arguments:

 

note: DB1-DB3 (sub-com through index) are omitted for brevity

NameDLBMotor (DB4)Enable (DB5)Dir (DB6)Command (DB7)DB8DB9Info
set steps9motor #0-30-31steps (unsigned int)Sets steps between shots for the given motor
ramp down7motor #0-30-32  Execute a downramp for given motor, starting with the next movement
move now9motor #0-30-33steps (unsigned int)Execute a move now with given motor
enable/dir change only7motor #0-30-34  Change only direction/enable parameter for motor

 

The Enable Flag allows you to specify how to modify the Enable parameter for the given motor via this action:

Enable ValueInfo
0Set motor enable to 'disabled'
1Set motor enable to 'enabled'
2Set motor enable to the opposite of its current value (invert)
3Leave motor enable unchanged

 

The Direction Flag allows you to specify how to modify the Direction of the given motor via this action:

Direction ValueInfo
0Set motor direction to '0'
1Set motor direction to '1'
2Set motor direction to the opposite of its current value (invert)
3Leave motor direction unchanged

 

Program Control Action

 

Program control actions control execution of the currently running program.  Start is included for completeness, but as keyframes cannot run when the program is not running, it would be difficult to call.  The following table lists each available command for this action type, from the Data Length Byte:

 

NameDLBSub-Com (DB1)Cntrl (DB2)IDX (DB3)Type (DB4)Info
stop 433index1stop program execution
start 433index2start program execution
pause 433index3pause program execution

 

Delete Action

 

The Delete Action control allows you to remove an action that you had previously stored.

NameDLBSub-Com (DB1)Cntrl (DB2)IDX (DB3)Info
delete 334indexdelete action at the given index

 

Sub-Command: Keyframe

 

The Keyframe sub-command allows you to place a keyframe at a specified point in the program.  Each keyframe can trigger an action you have defined with the Action sub-command.  Keyframes can be set for motor positions, exposures, or points in time.  That is, if you created an action that modified the time interval between exposures, you could call it when a motor has moved 10,000 steps, or when you've taken 50 exposures, or even when the program has been running for two hours. 

There are three primary types of keyframes: motor, camera, and time.  Each type can hold up to sixteen keyframes, and are identified by a keyframe index ranging from 0-15.  Once a keyframe has been activated, it is removed from memory so that you may re-use its position if needed, and so that it does not trigger again.  All keyframes require an action index for the action to call, and motor keyframes require you to specify the motor # for the distance measurement.

The following table lists each type of keyframe:

NameDLBSub-Com (DB1)Type(DB2)IDX (DB3)Value (DB4)Motor (DB5)Action IDX (DB6)Info
camera 641index10action indexcall action at exposure value
motor 642index2motor #action indexcall action at motor dist. moved
time 643index30action indexcall action at given run length