# The binary system - Programmable Logic controllers

The binary system is based on just two digits: 0 and 1. These are termed binary digits, orbits.

When a number is represented by this system, the digit position in the number indicates the weight attached to each digit, the weight increasing by a factor of 2 as we proceed 23 from right to left. Bit 0 is termed the least significant bit (LSB) and the highest bit in a binary number is termed the most significant bit (MSB). For example, with the binary number 1010, the LSB is the bitat the right end of the number (0 in this example). The MSB is the bit at the left end of the number (1 in this example).

The conversion of a binary number to a denary number involves the addition of the powers of 2 indicated by the place position of a number in the overall number. Thus for the binary number 1010, we have 1 with a place value of 23, 0 with a place value of 22, 1 with a place value of21, and 0 with a place value of 20, and so the conversion to a denary number is as follows: Thus the denary equivalent is 10. The conversion of a denary number to a binary number involves looking for the appropriate powers of 2. We can do this by successive divisions by 2, noting the remainders at each division. Thus with the denary number 31:

31 Ä 2 ¼ 15 remainder 1; this gives the LSB

15 Ä 2 ¼ 7 remainder 1

7 Ä 2 ¼ 3 remainder 1

3 Ä 2 ¼ 1 remainder 1; this gives the MSB

The binary number is 11111. The first division gives the LSB because we have just divided 31 by 2, that is, 21, and found 1 left over for the 20 digit. The last division gives the MSB because the 31 has then been divided by 2 four times, that is, 24, and the remainder is 1.

Programmable Logic controllers Topics