T-Series/Commands/Set Device Mode/T-Joy
From ZaberWiki
[edit] Special Note
This command allows setting several options. Each option is controlled by a single bit within the command data. Most software you will encounter, including most of our demo software, represents all 4 data bytes as a single decimal value rather than specifying each bit individually. To determine what decimal value to use requires a basic understanding of how the data is represented in binary. The command data may be considered as a single 32-bit binary value. The least significant bit is bit_0, the next is bit_1, the next is bit_2, and so on up to the most significant bit_31. Each bit may have a value of either 1 or 0.
The corresponding decimal representation of this 32-bit data is given by:
- Decimal value = (bit_0 * 1) + (bit_1 * 2) + … + (bit_n * 2n) + … + (bit_31 * 2^31)
Each bit controls a single mode option as described in the table below. To determine the data value to use with the Set Device Mode command, simply determine the desired value of each bit (1 or 0), and calculate the decimal value using the above formula. Note that not all 32 bits are currently used. Any unused or reserved bits should be left as 0.
For example, suppose you want all mode bits to be 0 except for bit_0 (disable autoreply), bit_14 (disable power LED), and bit_15 (disable serial LED). The Set Device Mode instruction should be sent with data calculated as follows:
- Command Data
- = 2^20 + 2^214 + 2^215
- = 1 + 16384 + 32768
- = 49153
Note that each instance of the Set Device Mode command overwrites ALL previous mode bits. Repeated commands do not have a cumulative effect. For example, suppose you send a Set Device Mode command with data of 1 to disable auto-replies. If you then send another Set Device Mode command with data of 16384 to disable the power LED, you will re-enable auto-replies since bit_0 in the 2nd instruction is 0.
The T-JOY has a default mode setting of 0 (all bits are 0).
| Bit_n | 2n | Description |
| bit_0 | 1 | Disable Auto-reply A value of 1 disables ALL replies except those to “return” commands (commands 50 and higher). The default value is 0 on all devices. |
| bit_1 | 2 | Reserved |
| bit_2 | 4 | Reserved |
| bit_3 | 8 | Reserved |
| bit_4 | 16 | Reserved |
| bit_5 | 32 | Reserved |
| bit_6 | 64 | Enable Logical Channels Mode A value of 1 enables the Logical Channels Mode. In this mode of communication, only bytes 3 through 5 are used for data. Byte 6 is used as an Id byte that the user can set to any value they wish. It will be returned unchanged in the reply. Logic Channel Mode allows the user application to monitor communication packets individually to implement error detection and recovery. The default value is 0 on all devices. |
| bit_7 | 128 | Reserved |
| bit_8 | 256 | Reserved |
| bit_9 | 512 | Reserved |
| bit_10 | 1,024 | Reserved |
| bit_11 | 2,048 | Reserved |
| bit_12 | 4,096 | Reserved |
| bit_13 | 8,192 | Reserved |
| bit_14 | 16,384 | Disable Power LED A value of 1 turns off the green power LED. It will still blink briefly, immediately after powerup. |
| bit_15 | 32,768 | Disable Serial LED A value of 1 turns off the yellow serial LED. |
