How Numbering Systems Work


Introduction to How Numbering Systems Work

When working with any PLC such as ControlLogix (or any digital computer), it’s important to understand how numbering systems work. The numbering system we are all used to is base-10 (Decimal). Mainly, that’s because we have 10 fingers. In the decimal numbering system, there are only 10 “symbols” available (0-9).

Think of digital computers as only having 2 fingers (0-1). Depending on the system, the computer is simply made up of hundreds to billions of switches. Obviously, each switch can only have two states that you can express in several ways: ON or OFF, 0 or 1, TRUE or FALSE, HIGH or LOW.

Decimal Numbering System

Generally, everyone is familiar with the Decimal numbering system. Let’s talk in detail about how this works, though. We have 10 symbols available: 0-9. Zero is a number, so we need to count it. Imagine a set of wheels. Each wheel has 10 digits (0 to 9). For each count, the wheel on the right increments. Each time it passes the value of 9, it increments the wheel to the left of it by one position.

Let’s say we end up with the value of 0027, for example. Each of these digits have a multiplier of thousands, hundreds, tens, and ones. In this case, we have the value of 2 in the 10’s position, so we take 2 x 10. This gives us a value of 20. Next, we add this to the value of the ones position. 7 x 1 is 7. Then we simply add these two values together to get 27. Obviously, we already knew that, but thinking along these lines for now will prepare you to understand the other numbering systems.

To clarify, each position is a power of the base: 10^3, 10^2, 10^1, and 10^0.

Binary Numbering System

As I said before, digital computers think in binary. Binary is a base 2 numbering systems. This means there are only two symbols available: 0 or 1. Imagine our wheel again, but this time, it only has 2 symbols on each digit. These symbols are 0 and 1. Each time the wheel on the right rolls over from the value of 1, it will increment the value of the position to the right. Our counts will be as follows:

DECIMAL     BINARY
  0000       0000
  0001       0001
  0002       0010
  0003       0011
  0004       0100
  0005       0101
  0006       0110
  0007       0111

Pay attention to the pattern in binary. It works exactly like decimal did, except we only have 2 symbols available. Each time we run out of symbols in the right most position, we increment the position to the left of it, and reset anything to the right back to zero. Let’s look at the value of 6 for example: 0110.

Just as in decimal, each position represents a power of the base: 2^3, 2^2, 2^1, and 2^0. In decimal, the value of each position is 8, 4, 2, and 1. We only have a “1” in positions 2 and 1. Therefore convert this to decimal, we would add (2^3 x 0) + (2^2 x 1) + (2^1 x 1) + (2^0 x 0). The value in decimal is 6.

Likewise, if we have the binary value of 1111, we would add 8 x 1 + 4 x 1 + 2 x 1 + 1 x 1. The answer would be 15.

Hexadecimal Numbering System

From time to time, you will come across values expressed in Hexadecimal. This is especially true with PLC’s and vintage computers. Hexadecimal numbers usually easier to express than decimal values. For example, instead of remembering 65535, we can simply remember FFFF. Additionally, hexadecimal values are easier to break down into binary. Each digit simply represents a binary bit pattern. This is why hexadecimal became very popular in the mid to late 70’s. Obviously, hexadecimal is a base 16 numbering system. However, using the standard numbering system, we only have 10 symbols (0 to 9). To get the extra 6 symbols, we use letters. Therefore, each digit in hexadecimal is 0-F. Let’s look at our chart again, but this time, let’s include Hexadecimal, and we’ll go all the way up to 18 decimal this time.

DECIMAL     BINARY     HEXADECIMAL
  0000       0000          00
  0001       0001          01
  0002       0010          02
  0003       0011          03
  0004       0100          04
  0005       0101          05
  0006       0110          06
  0007       0111          07
  0008       1000          08
  0009       1001          09
  0010       1010          0A
  0011       1011          0B
  0012       1100          0C
  0013       1101          0D
  0014       1110          0E
  0015       1111          0F
  0016      10000          10
  0017      10001          11
  0018      10010          12
  

Let’s take 12 in hex, and convert this to decimal. This would be (16^1 x 1) + (16^0 x 2). The answer is 18.

Octal Numbering System

Octal was popular prior to the mid 70’s. You will see octal on vintage machine, and in the PLC-5. Octal is a base 8 numbering system. In binary, every 3 bits represents an octal digit. Furthermore, you only have 7 symbols in octal, 0 to 7.

Let’s take a look at an octal chart:

DECIMAL     BINARY     HEXADECIMAL     OCTAL
  0000       0000          00           00
  0001       0001          01           01
  0002       0010          02           02
  0003       0011          03           03
  0004       0100          04           04
  0005       0101          05           05
  0006       0110          06           06
  0007       0111          07           07
  0008       1000          08           10
  0009       1001          09           11
  0010       1010          0A           12

Just as before, we’ll convert octal to decimal. Let’s take a look at 12 octal. To convert this to decimal, we would use the following formula. (8^1 x 1) + (8^0 x 2). The answer in decimal is 10.

Summary of How Numbering Systems Work

Each numbering system has a certain number of symbols that you have available. Fill up the least significant digit with these symbols. When you are out of symbols, simply increment the position to the left by 1, and reset the positions to the right. To convert to decimal, simply take the digit’s position to the power of the base, and multiply this by the value in that position. The position number starts at 0 on the right.

For more information on PLC’s, and Vintage Computers, visit the Main Site!

— Ricky Bryce

Leave a comment

Your email address will not be published. Required fields are marked *