5
Binary, decimal and hexadecimal code
Before going into the Hitachi PLC details, it is important to understand the numbering system of the
PLC. Electric devices like PLC’s can handle only digital data. The minimum unit of digital data is a
“bit”. 1 bit has two states, 0 or 1.
4 bits can give us 16 different values because of 2
4
as below left.
Since 4 bits of data is not easy to handle, the data is translated to hexadecimal code 0 to F as above
right. One hexadecimal code (= 4 bits) can express 16 different values.
4 hexadecimal codes have 65,535 values (= 16
4
). This unit (4 hexadecimal codes = 16 bits) is called
as “
Word
”. Normally Hitachi PLC handles binary data and word data.
This is a comparison table of one “
Word
” in binary, decimal and hexadecimal expressions.
2
10
16
2
10
16
0000 0000 0000 0000
0
H 0000
0000 0000 0011 1111
63
H 003F
0000 0000 0000 0001
1
H 0001
0000 0000 0100 0000
64
H 0040
0000 0000 0000 0010
2
H 0002
0000 0000 0000 0011
3
H 0003
0000 0000 1111 1111
255
H 00FF
0000 0000 0000 0100
4
H 0004
0000 0001 0000 0000
256
H 0100
0000 0000 0000 0101
5
H 0005
0000 0000 0000 0110
6
H 0006
0000 0011 1111 1111
1023
H 03FF
0000 0000 0000 0111
7
H 0007
0000 0100 0000 0000
1024
H 0400
0000 0000 0000 1000
8
H 0008
0000 0000 0000 1001
9
H 0009
0000 0111 1111 1111
2047
H 07FF
0000 0000 0000 1010
10
H 000A
0000 1000 0000 0000
2048
H 0800
0000 0000 0000 1011
11
H 000B
0000 0000 0000 1100
12
H 000C
0000 1111 1111 1111
4095
H 0FFF
0000 0000 0000 1101
13
H 000D
0001 0000 0000 0000
4096
H 1000
0000 0000 0000 1110
14
H 000E
0000 0000 0000 1111
15
H 000F
0111 1111 1111 1111
32767
H 7FFF
0000 0000 0001 0000
16
H 0010
1000 0000 0000 0000
32768
H 8000
0000 0000 0001 1111
31
H 001F
1111 1111 1111 1111
65535
H FFFF
0000 0000 0010 0000
32
H 0020
0 0 0 0
0 0 0 1
0 0 1 0
0 0 1 1
0 1 0 0
0 1 0 1
0 1 1 0
0 1 1 1
1 0 0 0
1 0 0 1
1 0 1 0
1 0 1 1
1 1 0 0
1 1 0 1
1 1 1 0
1 1 1 1
0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
Binary code
Hexadecimal code
4 bits
16 values
0 0 0 1
1
0 0 1 0 1 1 1 0 1 1 1 1
2
E
F
Word
0
1
or