Wednesday, August 26, 2015

How to Use Number System to PLC (Programmable Logic Controller)




PLC is based on microcontroller. It is stored information in binary digits (bits) form. Bits consist of two condition ON (1) and OFF (0). It is like switch state where 1 means ON and 0 as OFF condition. Cause there is only two numbers (1 and 0) so it called as binary. It really differ with our number system called decimal (dec=10) which consist ten number from 0 to 9.

Logic 0 and 1

PLC only understand signal ON and OFF. Imagine you have a switch, power source, and a lamp that connected in a circuit. When the switch is pushed or clicked, then the wire is connected and the lamp beam. This condition, in binary system, indicate the signal is present or the switch is ON and expressed as 1. The opposite condition when the lamp not beam is the OFF condition, signal is not present, or 0.

Logic 0 and 1 to PLC

Decimal

Number system have three common characteristics: digits, base, and weight. Digits mean kind of number that support by number system. Base is the amount of digits supported, and weight is multiplier factor refer to position of digits. Decimal and other number system is based on place-value system. Its position of number determine the weight. Here are the characteristics of decimal system:

Digits (ten)
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0
Base 10
Weight 1, 10, 100, 1000, ...

Binary

Most PLC use binary system. It consist of two digit 1 and 0. Like decimal which have weight 1, 10, 100, and soon, binary also have weight as 1, 2, 4, 8, 16, 32, etc. The base of number usually write as subscript, example 10001­2 = 1710 and 111112 = 3110 .

Digits (two)
0, 1
Base 2
Weight 1, 2, 4, 8, 16, 32, 64, ...

BCD (Binary-Coded Decimal)

Binary-coded decimal is representation of decimal number where each digit is represented by a four-bit binary. This system usually used with other devices, such as number display (led number or seven segment). Example 020110 = 0000 0010 0000 00012 .

Decimal
BCD
0
0000
1
0001
2
0010
3
0011
4
0100
5
0101
6
0110
7
0111
8
1000
9
1001

Octal

Octal (8) is not commonly used by PLC, but there some PLC still used octal system. For instance Automation Direct PLC that addressed the memory in octal. The weight of octal derived by power the base number with position of number. The number of position is start from 0 and incremented by 1 from right. For example 17678 is equal to (7 x 80) + (6 x 81) + (7 x 82) + (1 x 83) = 7 + 48 + 448 + 512 = 101510 .

Digits (eight)
0, 1, 2, 3, 4, 5, 6, 7
Base 8
Weight 1, 8, 64, 512, 4096, ...

Hexadecimal

Hexadecimal (hex = 16) is decimal numbering system added by the first six alphabet A, B, C, D, E, and F as the symbols. Hexadecimal is used by PLC because its ability to represent large number of binary in small space. Each hexadecimal digit represent a group of four binary bits. Example 2B16 = (11 x 160) + (2 x 161) = 4310 .

Digits (16)
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F
Base 16
Weight 1, 16, 256, 4096, ...

Bits, Bytes, and Words

A group of one binary called bit (b-inary dig-it). A group of 4 bits called nibble. A group of 8 bits is called byte, and a group of 16 bits are referred as word.

Bits, Bytes, and Words of PLC

Convert Number System

It is not easy to convert one number system to another number system manually. For common case you will need to convert decimal (our native number system) to binary, octal, or hexadecimal. If you need the detail explanation about converting number system manually, then you can search it with your favorite online search engine.
The quickest way to convert number system can be found by using built in calculator in Windows operating system. For Windows 8 user, you can push window button on your keyboard and then type “calculator”. Open the calculator icon like image bellow.
Calculator Windows 8

If your calculator still looks standard like bellow, then you have to convert its mode to “Programmer” mode by press “Alt + 3” on your keyboard. Or from main menu by clicking “View > Programmer”.
Calculator mode to Programmer

In programmer-mode your calculator will be able to convert number system easily. You can select your base numbering system from radio-button on the upper left. Then type your number. To convert it to another number system, you just need to select radio-button again to base number you are referring.Don’t forget that Hex = hexadecimal, Dec = decimal, Oct = octal, and Bin = binary.
hexadecimal to decimal in calculator

The radio-button on the bottom-left is to switch binary representation as byte (8 bits), word (16 bits), dword (double, 32 bits), and qword (quad, 64 bits). The number bellow the binary means as index of the binary representation.
8 bits, 16 bits, 32 bits, and 64 bits in calculator

Conversion Table

Here are some example of conversion number system.
Decimal, Binary, BCD and Hexadecimal of conversion number system


Labels:

Newer Post Older Post Home

You may also like these ebook:

Get Free PLC eBook directly sent to your email,
and email subscription to program-plc.blogspot.com




We hate SPAM. Your information is never sold or shared with anyone.

Your Email Will Be 100% Secured !

Your email is stored safely on Google FeedBurner