5.2.16. Values and Constants (K, 16#)
-
The explanation on data units which could be used in the system:
Name
Bit
Nibble
Byte
Word
Double word
Quadruple word
The relation among bits, nibbles, bytes, words, and double words in the binary system is shown below.
W 1
B Y 3
N B7
N B6
b31 b30 b29 b28 b27 b26 b25 b24b23 b22 b21 b20 b19 b18 b17 b16 b15 b14 b13 b12 b11 b10
-
The PLC uses four types of values to execute the operation according to different control purposes. The functions of
these values are illustrated as follows:
1. Binary number (BIN)
The PLC adopts the binary system to operate the values.
2. Decimal number (DEC)
The decimal number in the PLC is used as;
the setting value of the timer (T) or the setting value of the counter (C/HC). For example, TMR C0 50
(constant K).
the device number. For example, M10 and T30 (device number)
the number before or after the decimal point. For example, X0.0, Y0.11, and D10.0 (device number).
the constant K: It is used as the operand in the applied instruction. For example, MOV 123 D0 (constant K).
3. Binary-coded decimal (BCD)
A decimal value is represented by a nibble or four bits, and therefore sixteen consecutive bits can represent a
four-digit decimal value.
4. Hexadecimal number (HEX)
A bit is the basic unit in the binary system. Its state is either 1 or 0.
A nibble is composed of four consecutive bits (e.g. b3~b0). Nibbles can be used to
represent 0~9 in the decimal system, or 0~F in the hexadecimal system.
A byte is composed of two consecutive nibbles (i.e. 8 bits, b7~b0). Bytes can be used to
represent 00~FF in the hexadecimal system.
A word is composed of two consecutive bytes (i.e. 16 bits, b15~b0). Words can be used to
represent 0000~FFFF in the hexadecimal system.
A double word is composed of two consecutive words (i.e. 32 bits, b31~b0). Double words
can be used to represent 00000000~FFFFFFFF in the hexadecimal system.
A quadruple word is composed of four consecutive words (i.e. 64 bits, b63~b0). Quadruple
words can be used to represent 0000000000000000 – FFFFFFFFFFFFFFFF in the
hexadecimal system.
D W
B Y 2
N B5
N B4
N B3
Ch a pt er 5 Un d er s t a n d in g Com m on D e v ic e s
Description
W 0
B Y 1
B Y 0
N B2
N B1
N B0
b9 b8 b7 b6 b5 b4 b3 b2 b1 b0
D ouble w ord
W ord
B yt e
N ib ble
B it
5_
5 - 1 1