4.2 Bits, Bytes and Words
As in all digital technology, the smallest unit of information in a PLC is a “bit”.A bit can only have
two states: “0” (OFF or FALSE) and “1” (ON or TRUE). PLCs have a number of so-called bit
devices that can only have two states, including inputs, outputs and relays.
The next larger information units are the “byte”, which consists of 8 bits, and the “word”, which
consists of two bytes. In the MELSEC System Q range of PLCs the data registers are “word
devices”, which means that they can store 16-bit values.
Since a data register is 16 bits wide it can store signed values between -32,768 and +32,767
(see next chapter 4.3). When larger values need to be stored two words are combined to form a
32-bit long word, which can store signed values between -2,147,483,648 and +2,147,483,647.
4.3 Number Systems
The PLCs of the MELSEC System Q use several different number systems for inputting and
displaying values and for specifying device addresses.
Decimal numbers
The decimal number system is the system we use most commonly in everyday life. It is a “posi-
tional base 10” system, in which each digit (position) in a numeral is ten times the value of the
digit to its right. After the count reaches 9 in each position the count in the current position is
returned to 0 and the next position is incremented by 1 to indicate the next decade (9 à 10, 99
à 100, 199 à 1,000 etc).
–
Base: 10
–
Digits:0,1,2,3,4,5,6,7,8,9
In the MELSEC System Q family of PLCs decimal numbers are used for entering constants
and the setpoint values for timers and counters.Device addresses are also entered in decimal
format, with the exception of the addresses of inputs and outputs.
Binary numbers
Like all computers a PLC can only really distinguish between two states, ON/OFF or 0/1.These
“binary states” are stored in individual bits. When numbers need to be entered or displayed in
other formats the programming software automatically converts the binary numbers into the
other number systems.
–
Base: 2
–
Digits: 0 and 1
4–2 MITSUBISHI ELECTRIC
Bits, Bytes and Words An Introduction to Programming
0000000000 000
0
00
1 Byte 1 Byte
1 Word
Bit 15 Bit 0