If you're new to Allen-Bradley PLC programming, I'm going to give you some information that you can put to work...immediately! In this free Allen-Bradley PLC training tutorial I'll walk you through the basics of addressing discrete inputs, outputs, binary bits, timers and counters.
For this basic PLC training tutorial, you will need RSLogix 500 or Micro to be able to test the concepts of this post. If you don't already have RSLogix 500 or Micro yet, you can get it along with RSLinx and RSLogix Emulate 500 by watching the first video in my FREE Mini PLC Course .
Also, if you want an introduction to Ladder Logic before you start, check out this post. For everyone else, open up your RSLogix 500 (or 5 or Micro) and let's get to work.
NOTE: This is an original post, however it was inspired by a similar post at Engineer-and-Technician.com. You can see that post here.
A bit is computer-speak for a value or register that can only be a 1 or a 0; true or false. Discrete inputs and outputs are examples of bits. Bits can also be internal coils (internally used in a PLC program but not tied to any real inputs or outputs).
In RSLogix 500, the address of the bit can be shown a couple different ways. The default format is:
NOTE: A word is 16 bits. A word sometimes is called an integer or a register. The point is, it is a value that represents 16 items that can be 1 or 0...in other words 16 bits.
An address that references the input of a SLC500 input module. would look like:
I:2/1 (don't confuse I for one or vice versa)
The I means it is referencing a physical channel on an input module. The 2 means the input module is in slot 2 of the rack (the third slot from the left). The 1 means it is channel 1 (the second input channel on that module).
NOTE: When programming a MicroLogix PLC, slot numbers do not apply since all the I/O is built in to the controller. All I/O references use "slot 0" in MicroLogix project. For example I:0/1
Here's an example of an output address:
O:5/0 (don't confuse O for zero or vice versa)
The O means it is referencing a physical channel on an output module. The 5 means the input module is in slot 5 of the rack (the sixth slot from the left). The 0 means it is channel 0 (the first output channel on that module).
NOTE: PLC addresses always start from 0, not 1. This is common among all programming languages. Addressing always starts at zero unless otherwise defined. Keep that in mind as we go along.
The input address above could be connected to any sort of discrete input device like a toggle switch or a push-button. The output address could be connected to any discrete output device like a motor starter, or a light bulb.
Internal bits are only used within the PLC program. They do not reference physical inputs or outputs. Internal bits simulate relays within the Ladder Logic. The most basic way to activate an internal bit is to make it an output (OTE) on the right side of the rung.
When this output (OTE) or "relay coil" is activated it will operate the various "contacts" (XIC or XIO instructions) that reference the same bit address anywhere else in the program. Check out this short video on for a quick example of how internal bits can be used in your Ladder Logic program!
In RSLogix 500, the “B3” (binary) file is the most commonly used binary file for all the internal bits. You can add other data files that will function just like the B3 binary file, but we will just use the B3 file for the sake of simplicity (I like simple!).
Remember the default format for addressing in RSLogix 500 is:
B3:0/0 (don't confuse O for zero or vice versa)
The B3 means it is referencing a an internal binary file. The 0 means it is referencing the first element in the B3 data table (each element/word has 16 bits). The 0 means it is the first bit in the word.
NOTE: Unlike the input and output data files, you have to use the file number in the address for internal bits. In this case, the default file number is 3.
A timer is an instruction that turns on or off bits after a preset time is reached. There are three types of timer instructions: the timer on delay (TON), the timer off delay (TOF) and the retentive on delay (RTO). In RSLogix 500, file 4 for is used for timers. Referencing a timer address looks like:
The T4 means it is referencing a timer (of course!). The 0 means that it is the first timer type in the T4 data table.
The most common use of the timer involves using its done bit (DN). The DN bit could be used to trigger an output (like our O:5/0 above) or an internal bit (like our B3:0/0 above). Accessing the DN bit of the timer we addressed above will look like T4:0/DN. The DN bit will turn on when the timer finishes timing out (the accumulator reaches the preset value). The two other commonly used bits in a timer are the enable bit (EN) and the timer-while-timing bit (TT).
A counter is an instruction that turns on or off bits after a preset count is reached. There are two different types of counter instructions: The count up (CTU) and the count down (CTD). In RSLogix 500, file 5 for is used for counters. Referencing a counter address looks like:
The C5 means it is referencing a counter (of course again!). The 0 means that it is the first counter type in the C5 data table.
The most useful bit on a counter is the DN bit. It is similar to the timer DN bit. When counter finishes counting (the accumulator reaches the preset value) the DN bit is turned on. Accessing the DN bit of the counter we addressed above will look like C5:0/DN.
If you want to learn more about how Timers and Counters work in RSLogix Micro, check out this free Ladder Logic Instructions Cheat Sheet.
Now that you've seen how bits, timers and counters can be addressed, try putting your knowledge to work!
In RSLogix Micro (or 500), try creating a VERY SIMPLE one-rung program for a MicroLogix PLC that turns on output channel 5 of "slot 0" when input channel 1 of of "slot 0" turned on(remember MicroLogix PLCs only have slot 0 since all the I/O is built into the controller) .
You can label the input and output whatever you want (push-button, switch, etc for the input and relay, motor start, light, etc for the output).
PLCs are really not that complicated. If you are new to PLCs or just looking to get a better handle on how they work, check out this free cheat sheet, called the "Motivated Electrician's Guide to Understanding ANY PLC System."