PLC Programming HandbooksPopular ArticlesNavigationUser login 
Binary People: Learning your 1's and 0'sIntroduction"There are 10 types of people in the world: Those who understand binary, and those who don't." If you don't get this joke then hopefully by the end of the chapter you'll get a chuckle out of it. You see, in the binary number system 10 = 2. How? Consider if you had no choice but to count with only a zero or a one. Pretend that the evil goblin of number snatchers had taken every number from two to nine. How would you count anything? You'd have to do it like 0, 1, 10, 11, 100, 101, 110, 111 and so on. You get the point? Therefore, if you had three apples then the third apple would be designated as 10 when in reality you only have three apples to eat. When it comes to computers and therefore PLCs they can only store in memory a 0 or a 1. That's the beauty of our digital age, it's either "on" or it's "off". Those memory chips in computers are actually made of rows upon rows of circuits that are either on at some voltage or off at some voltage. Therefore a computer at it's very basic level can only count using a 0 (off) or a 1 (on). That's why it's called binary because there are only two numbers like there are only two wheels on a bicycle. The number system we are used to using is called decimal (dec = 10) and therefore we get to use ten numbers from 0 to 9. When you think about it, it's truly arbitrary how we count. You could also use an octal system (by 8) or hexidecimal (by 16) numbering system which we'll talk about a little later. Base 10: An Old Familiar FriendLet's start off by looking closer at our all too familiar base 10 decimal system and then compare it to binary. Decimal, like all these other number systems, is based on placevalue system. This means that the value of a digit depends both on the digit itself and it's position within the number. The following figure shows the weights of a decimal number broken down into columns.
That much is obvious right? So with a number like 9876 we add it up like this:
The value of the number is computed by multiplying each digit by the weight of its position and adding up the results. Now for Binary People: Learning your 1s and 0s.">BinaryRemember that for a base 10 system the weights are 1, 10, 100, 1000 and so on. For a binary system the weights are 1, 2, 4, 8, 16, 32, 64, etc. To figure out the value of a binary system we do the same as with the decimal but with different weights.
The base of the number is usually expressed in a subscript so that in our examples 11111_{2} = 31_{10} and 10101_{2} = 21_{10}. It sure is a little cumbersome to count in binary but at least it's easier then Roman numerals .
Word, Byte and BitWhat do you call a group of binary digits? The geeks who first thought this stuff up decided to call a binary digit a bit (binary digit). This is not to be confused with Timbits. After some time they decided that it would be good to call a group of 8 bits a byte. Funny bunch of geeks that they were the term nibble became used for 4 bits being a subset of byte. Finally, a group of 16 bits are referred to as a word. Here's a picture to drive home the point. Cheating with a CalculatorUnless you're a glutton for punishment a standard scientific calculator switches between the different number formats with ease. In fact there's one built into the Windows operating system that typically lives under the Start button  All Programs  Accessories. Pull down the View menu and select "Scientific". I've highlighted the area below where you can switch between hexadecimal, decimal, octal and binary. Very handy even for doing math and logical functions (i.e. AND, OR, etc.).

While octal is not as common
While octal is not as common as it's cousin hexadecimal portable generator review it is still used in various PLCs so it's important to grasp the concept.