| cmdMSG_WR | Index |
Command Code:
The Packet Is Either:
| 0 | 1 | 2 | 3 | 4 | ||||
| address | 3 | cmdMSG_WR | FOFFS | MDATA |
| FOFFS - | [ (7) WFLAG=0 | (6:0) MBOFFS ] |
| MDATA - | 1-6 message data bytes. |
Or:
| 0 | 1 | 2 | 3 | 4 | ||||
| address | 3 | cmdMSG_WR | FOFFS | MDATA |
| FOFFS - | [ (7) WFLAG=1 | (6:0) MBOFFS ] |
| MDATA - | SLOT byte followed by 1-5 message data bytes. |
Description:
This command is used to save reflex command data, or "reflex messages", to a BrainStem module.
When WFLAG=0, this command writes up to 6 bytes of data to a write buffer starting at the the message byte offset, MBOFFS. When WFLAG=1, this command calculates the address of the appropriate message slot using the first data byte for SLOT number, writes the remaining bytes to the buffer starting at MBOFFS, and finally writes the message to the EEPROM. This saves EEPROM write cycles. A full 10-byte message may be saved with 2 commands. The first command has a FOFFS byte and 6 data bytes. The last command has a FOFFS byte, SLOT byte, and 4 data bytes. A message of up to 5 bytes may be saved with a single command.
A packet size that is invalid will generate an error message.
The following table has some examples for defining reflex messages in a module with an address of 2. The first message contains 10 bytes and must be broken up into two commands. The second message has 4 bytes and can be sent as one command. In the Command column, the size byte is denoted by parentheses.
| Message ID | Command | cmdMSG_WR command(s) |
| 10 | 2, (8), 23, 1, 2, 3, 4, 5, 6, 7 | 2 12 0 2 8 23 1 2 3 2 12 134 10 4 5 6 7 |
| 11 | 2, (3), 23, 15, 16 | 2 12 128 11 2 3 23 15 16 |