The entire line of ASI Controls hardware uses onboard memory chips to store both the firmware for the controller, and the operating configuration. As you work with our controllers, you will need to know where in the memory the information you want to access is stored. Understanding how the controller stores that information is helpful, since many times, you see that information in an unformatted condition.
The processors in the our controllers work with memory to store information. This memory contains what are called bits. A bit is the smallest piece of information, and it functions like a switch, which means it is equal to one of two possible values. If a bit is on, is it said to be set. If it is off, it is said to be cleared.
Click here for an interactive bits and Bytes Worksheet. This worksheet will help to show how individual bits are combined into analog values.
The status of a bit is a perfect way to record the status of binary information in a controller, since binary information is either on or off. For example, the Poll List is used to store information about controllers on the Local Bus. Each Poll List index has an attribute which shows the communicaion status of that controller. This communication status is binary in nature. It is either communicating, or it is not.
This allows us to establish a relationship between the real-world values, and the status of our bit in the controller's memory. This relationship can be defined as follows: When the communcation status is "no error", then clear the bit; when the communication status is "error", set the bit.
What do we do when we need to store analog information? Analog values are numerical. This makes them differ from binary values in that they can not be stored in a single bit in the controlllers memory. Instead, they are stored in groups of bits.
The standard memory grouping is defined as a Byte. A Byte is a collection of eight bits. We can now set different combinations of the bits in our Byte to reflect analog values. This is called encoding. The bits are numbered zero through seven, and are listed right to left.
The table below list the eight bits in a Byte, and shows their repective values.
Position | bit7 | bit6 | bit5 | bit4 | bit3 | bit2 | bit1 | bit0 |
Value | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
As you can see, each bit has a unique value. When an individual bit is set, it's unique value is added to a total for the whole Byte. For example, to represent a value of 37, you would need to set bit0, bit2 and bit5. This would give you values of 1, 4, and 32. When added up, they equal 37.
There are some unique properties about these bit values, which is why they were chosen.
For one thing, there is only one possible combination of values that can be used to reach any specific final result. As in our previous example, there is only one way to get a final result of 37. If you don't believe me, try and find another combination of bits that will yield 37. You will not be able to do it.
You will also find that the sum of all previous bits will not exceed the next available bit. For example, setting bit0 through bit4 will give you a final result of 31. This does not exceed bit5, which has a value of 32. This is true for all the bits.
One other concern is negative numbers, and decimals. You will notice that bit math does not provide a way to represent numbers less than zero. As an extension of that policy, there is no way to represent partial numbers, or decimals. Since all computers and processors in the world use bits in memory to store information, it is worth noting that there is no natural way to show these values. They are always interpreted, from true positive whole numbers.