AVR Command List

From molecubes
Jump to navigation Jump to search

This page describes commands available for querying and control of attached Molecube modules using the inter-module RS-232 serial interface. These commands can be found across all Molecubes. Any variations are denoted in the specific cube sections below. This has been adapted from this spreadsheet on GitHub which is to be treated as the primary resource.

Name Instruction Instruction Params Response Parameters Notes
Global Commands, common for all Molecube modules
Set Address with Orientation Pin 0x04 p[0] Address No Parameters – No Errors
p[0] = 1 – Slave comm timeout
p[0] = 2 – Slave comm error
Broadcast command, device which orientation pin high sets provided address and responds indicating address successfully set.
Get Measured Angle 0x07 None Calculated angle in tenths of degrees (12bits)
Filler (4bits)
Set Orientation Pins 0x08 p[0] = Side - bits 4-7
Pin ID – bits 2 - 3
Filler – 1bit
State – 1bit
No parameters – no errors
p[0] = 1 - Pin is an output already
p[0] = 2 - High input level detected
p[0] = 3 - Requested board absent
p[0] = 4 - Slave communication timeout
p[0] = 5 - Slave communication error
Get Orientation Pin 0x09 None p[0] = M3..0, R3..0 (master)
p[1] = L3..0(m), M3..0 (slave)
p[2] = R3..0, L3..0 (slave)
p[3] = 1 - Slave comm timeout
p[3] = 2 - Slave comm error
ALL PINS ARE INPUTS unless set to Output = High
Sets both data direction and value (for outputs) of individual orientation pins. Checks input first to avoid short circuit
Servo Angle Tracking 0x0E filler - 7bits
Tracking Status (ON / OFF) - 1bit
Set LEDs 0x12 p[0]=Filler (must be 0) - 5bits
p[0]=BoardID (0 - 5) - 3bits
No parameters - no errors
p[0] = 1 - Right slave board not installed
p[0] = 2 - Left slave board not installed
p[0] = 3 - Slave communication timeout
p[0] = 4 - Slave communication error
Actuator-specific commands
Get Goal Speed and Angle 0x15 p[0]=GoalAngle & 0x00ff (LSB)
p[1]=(GlAngl & 0xff00)>>8 (MSB)
p[2]=GoalSpeed & 0x00ff (LSB)
p[3]=(GSpeed & 0xff00)>>8 (MSB)
None Goal Angle (0..3600)
Goal Speed (0..3600)
Gripper-specific commands
Gripper actuation 0x17 Position & 0x00ff (LSB)
(Pos & 0xff00)>>8 (MSB)
Speed & 0x00ff (LSB)
(Speed & 0xff00)>>8 (MSB)
Force & 0x00ff (LSB)
(Force & 0xff00)>>8 (MSB)
None Pos 0..1023
Speed 0..1023
Force 200..(400)..500

Currently the battery Molecube does not support any custom commands. An idea for functional expansion of the battery might include hardware supporting voltage and current monitoring both of the unregulated and regulated voltage buses. A command to query the status of this monitoring hardware would then be implemented.

Related Pages