This is a basic tutorial about binary numbers. It begins with a discussion about
decimal numbers and then moves on to binary numbers. The tutorial then applies this
knowledge to ADU200 boards.
Decimal
The numbers we use in daily life are based on the number 10. We call these base 10 or
decimal numbers.
For instance take the number 1,111 which is spelled out as
one thousand one hundred and eleven.
The number 1,111 can be broken into a sum
Factoring the numbers gives
Expressing the value with exponents gives
Generally
To convert a four digit number "abcd" in base
"y" to decimal base 10 simply plug the value for "y" into the formula.
Binary
To treat 1111 as a binary number we use the value 2 as the base. Note that we will use red to indicate a binary number and black to indicate a decimal number.
Calculating the exponents gives
ADU200 Relays
The ADU200 relays are labelled K3, K2, K1 and K0. The mk command is used to set the
relays on an ADU200 board. To compose the mk command treat the desired states of
K3,K2,K1,K0 as a binary number and convert it to decimal. Append the decimal value to the
command.
For example: the mk15 will turn all the relays on, since as shown above, binary 1111 = 15 in decimal.
Similarly to turn on K3 and K2 with K1 and K0 off send the command mk12 since binary 1100 = 12 in decimal.
The following screen shot shows the mk4 command being sent to the ADU200. This will set
relay K2 on since binary 0100 = 4 in decimal.
The response shown in the screen shot is the ADU200's reply to an rpk command to show
the relay status. Each character corresponds to a relay on the board K3, K2, K1, K0. A 1
means the relay is on and 0 means the relay is off. The response of 0100 means that relays
K3, K1, K0 are off and relay K2 is on.
The state of the ADU200 can be seen in this photo.
The following screen shot shows the mk10 command being sent to the ADU200. This will
set relays K3 and K1 on since binary 1010 = 10 in decimal.
The effect on the ADU200 can be seen in this photo.
Tabular Method
If you are uncomfortable with binary you can simply look up the relays in this table
and add up the corresponding values to derive the mk command.
Relay 
K3 
K2 
K1 
K0 
Value 
8 
4 
2 
1 
For the ADU208 which has 8 relays the table is:
Relay 
K7 
K6 
K5 
K4 
K3 
K2 
K1 
K0 
Value 
128 
64 
32 
16 
8 
4 
2 
1 
For example to turn on relays K6 and K2 on the ADU208 send the command "mk68"
(ie. 64 + 4).
