Molecube Packet Specification

From molecubes
Jump to navigation Jump to search

This page is a wiki representation of the primary document found in this document on GitHub.

General Molecube Packet Structure
Header Class ID Param Num Instruction Param0 ... ParamN Checksum
Component Description
Name Range Description
Header 0xFF This is a single byte which identifies an incoming packet
Class 0x00-0xFF This is a single byte identifying the class of the target device. (See Device Classes)
ID 0x00-0xFD Unique class address. There are 254 available Ids for each individual class.

Class Broadcast Address: 0xFE

Param Num 0x00-0xFF Parameter byte count. Maximum parameter count is 256 parameters per packet. It is important to note that the overall packet is as follows:

Overall Packet Length = 6 + Length The overall packet length takes the header, class, id, length, instruction, and checksum into account.

Instruction 0x00-0xFF Instruction to perform (See AVR Command List)
Parameter0...N 0x00-0xFF Parameters specific to each instruction
Checksum 0x00-0xFF A simple 8bit checksum value. Calculated as follows:

Checksum = (ID + LENGTH + INSTRUCTION + PARAM1 + ... PARAMn)

Related Pages