PLC Memory For Beginners
Are you struggling to learn PLC binary bit, byte and word memory? Well don’t worry I’m going to simplify your learning process with a tool you can use.
Is This You?
I understand while trying to learn this yourself you’ve probably said that ‘this is too hard to learn’ or ‘how do they expect me to learn this when it doesn’t make sense’ or ‘I will never get this memory stuff!’.
We all know, when starting our new careers, one of the hardest lessons to wrap your head around especially as a new PLC programmer is trying to understand complex formulas like computer memory.
And learning about computer memory can be complex. In my experience I wanted to pull my hair out, I lost sleep, and struggled with projects in the real world.
Maybe your failing tests (if you’re in school) or struggling trying to learn this online at home.
Fear not, I will discuss with you what you need to learn and show you a tool you can use to shortcut the learning.
What is Binary Memory?
Binary is a numbering system, used in computers. Its used when a decimal number like 1, 2, 3, 4, etc. has been converted into a (1) or a (0) which a numbering system a computer uses.
What is a Binary Bit?
The short answer is that it is the smallest unit of data in a computer. A bit has a single binary value (a binary is a numbering scheme), that contains either a (0) or a (1).
Now hang in there, don’t worry, I won’t go all geek on you, but this is the info you need to know. And remember I promised I would show you a shortcut to understanding how it is used shortly.
Why Does Binary Only Use a 1 or a 0?
Well that’s pretty simple, to begin with a computer uses digital transistors an electro-mechanical switch which only has two functional options.
Which operate like a light switch in your home, there is an on and an off, imagine walking into your bedroom and switching the light on and off.
The transistor has an on and an off, a (1) for on and a (0) for off. Every time the transistor transitions from an off (0) to an on (1) the binary data changes. It’s really that simple.
The (1) and the (0) are the binary numbering system.
I Hate Programming
I Hate Programming
I Hate Programming
I Love Programming
What is a Byte?
In short, its just 8 bits in a row, which represents a binary number. A binary number isn’t too complicated to understand. Let’s start with what I mentioned above, and that was that a bit can only contain a 0 or a 1 in it.
Because you can only hold a zero or a one in the bit you would need to create a formula using only 0’s and 1’sto represent numbers above the number of 1.
That’s where the binary numbering scheme comes in. The numbers we usually count with is called the decimal numbering system. You know, 1, 2, 3, 4, etc. But when you can only use 0’s and 1’s then you need a numbering system to represent the other numbers.
For example; 4 in binary is 100, that isn’t a one hundred but instead a 1 and a zero and a zero.
And 11 in the decimal numbering system is 1011, which is pronounced as a one, a zero and a one and a one.
But, if not don’t worry, I will show you a shortcut to calculating the conversion between the two numbering schemes.
Regarding using a byte, the number 122 in the decimal numbering system is 0111 1010, an eight-bit number. So, if you’re going to need to store the number 122 in your PLC programs memory you are going to need to use a byte of memory.
Hopefully you’re still reading this and that it makes sense to you, if so, hang in there, because there is still a little bit more to learn and then I will show you a method to simplify converting the numbering systems.
What is a Binary Word and a Double Word?
Ok, now a word in the binary numbering system is not a verb, adverb or a noun. Instead a word is two bytes, 16 bits in a row. That’s all it is.
If you have a number like; 12,245, then your going to need 16 bits to store your number in binary. Because the binary conversion of the decimal number of 12,245 is; 0010 111 1101 0101
It’s that simple.
And a double word has a 32-bit memory storage. 32-bits’, which includes 4 bytes and 2 words.
The Shortcut Tool
Now on to the shortcut to simplifying binary memory in a PLC
Let’s, start with, I hope the above explanations made sense. When I first started programming, I wish someone had explained all this to me, like this.
To begin with we know when working with numbers in a PLC we usually use both the decimal and binary numbers.
We use the decimal numbers to display to machine operators for example and binary numbers are stored in our PLC memory.
When using them as a programmer you will need to convert them quickly and easily and the shortcut is right on your laptop or desktop computer. Just open your windows calculator and click the menu option in the top left-hand corner and choose the programming option.
There you will find a regular calculator and the readouts for the binary conversions as well as the other 3 numbering schemes used at various times in programming.
Its simple, just type in any number and you will see its equivalent conversion.
To me it doesn’t get any easier.