Copyright © Zaber Technologies Inc.
8.12 Set Device Mode (#40)
Firmware Version:
Version 5.00 and up
Command Number:
40
Data Bytes:
Each bit of the data bytes enables or disables a specific option.
Reply Data:
Reply data is simply an echo of the command data
Note:
All settings are stored in non-volatile memory and will persist after power-down
or reset.
This command allows setting several options. Each option is controlled by a single bit within the data
bytes. 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 data bytes 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_3 * 4) + … + (bit_n * 2
n
) + … + (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:
Data value
= 2
0
+ 2
14
+ 2
15
= 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 2
nd
instruction is 0.
The T-JOY has a default mode setting of 0 (all bits are 0).
Bit_n 2
n
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
Page 23 of 32