Drum instructions are great tools when you have a simple sequence of events that need to occur at a set time interval or as a result of an event. They mimic an electromagnetically drum sequencer. The BRX Series PLC has a drum in the instruction set.
Have you ever seen the mechanisms of a music box? Ok so it’s a little drum with pegs that catch and flick the chimes in a particular sequence to play whatever tune is on the drum. So in the PLC you can have a drum driven by an event, (input from a limit switch or button), or by time.
We will discuss the drum instruction and look at an example of controlling traffic lights with a cross walk signal.
Previously in this BRX series PLC we have discussed:
System Hardware – Video
Unboxing – Video
Installing the Software – Video
Establishing Communication – Video
Firmware Update – Video
Numbering Systems and Addressing – Video
First Program – Video
Monitoring and Testing the Program – Video
Online Editing and Debug Mode – Video
Timers – Video
Counters – Video
High Speed IO – Video
Compare Instructions – Video
Math Instructions – Video
Program Control – Video
Shifting Instructions – Video
Let’s look at an example. We will control a set of traffic lights, Red, Yellow and Green for an intersection. A cross walk signal will also be used for each direction of the traffic lights.
In a previous post we have discussed the sequencing of traffic lights using discrete outputs and timers. We also used indirect addressing to control the lights.
Building a PLC Program that you can be proud of – Part 1
We have used the drum instruction in a previous post. PLC programming example – Palletizer Drum Instruction.
Now we will use a drum instruction to control the lights.
Set 1 lights:
Red (Y0), Yellow (Y1) Green (Y2)
Set 2 lights:
Red(Y4), Yellow (Y5) and Green (Y6)
The sequence of operation will be as follows. We will have a Red / Red overlap of 3 seconds then set 1 will go Green for 10 seconds. Set 1 will then go Yellow for 2 seconds before the Red / Red overlap of 3 seconds again. Set 2 will then go Green for 10 seconds, then Yellow for 2 seconds. The sequence will then start again with the Red / Red overlap.
We will use input C2 to jog the sequence so we will not have to wait for the time to expire in each step.
These are the parts of the drum instruction:
DRUM Struct – This is the name of the drum heap item. In our case the name of the drum heap is Traffic_Lights
Step Preset: 1 – This is the step to go to when the reset input is activated.
Step – We have 1 to 16 steps in the DRUM. The time base is set at milliseconds. (1000 msec = 1 second)
Outputs – The outputs are located at the top of the instruction. We can set 16 outputs. In our case we currently only have 6 that are set for the lights.
The black squares represent the on conditions during that step in the sequence. Clicking each of the squares in the grid will turn them on or off. The black squares represent an on status for the step and the corresponding output.
Here is our ladder logic.
We have three inputs to the DRUM instruction.
Run – This will determine if the instruction is running or not. (Timing) Note: Even through the run input is off the outputs for the step are still active.
Jog – This input will advance to the next step during a transition from off to on. In our case C2 when turned on will go to the next step in the instruction.
Reset – This input will reset the drum instruction to the Step Preset that we specified. In our case this is step 1. If we need to vary the step that we go to, then use a memory location to store the Step Preset value. We are using the first scan system flag to reset our DRUM instruction so we have a Red / Red overlap once power is restored to the controller.
Notice that the drum is self resetting. We use the drum heap item done bit to reset. (Traffic_Lights.Done)
Here are the other heap instructions that are automatically assigned when we use a drum instruction in our program.
Remember that these items are set when we name our drum instruction.
Pedestrian Signal Logic
Monitor the step in the sequence. Do not allow the signal to change when currently green but ensure that the signal is remembered. We set a bit when the pedestrian input X0 or X1 is set. If the light is not currently green at the time for the corresponding lights another bit is set. This will then trigger the pedestrian output for each of the corresponding lights.
You can watch the video below to see how the drum instruction (Light Sequence) works in the BRX Series PLC.
You can download the program here.
BRX Series PLC from Automation Direct – Power to deliver
Overview Link (Configure and purchase a system)
Manuals and Product Inserts (Installation and Setup Instruction)
Do-More Designer Software v2.0.3 (Free Download Link) – The software will contain all of the instruction sets and help files for the BRX Series PLC.
Next time we will look at serial communication in the BRX PLC.
Watch on YouTube : BRX PLC Drum Instruction
If you have any questions or need further information please contact me.
If you’re like most of my readers, you’re committed to learning about technology. Numbering systems used in PLC’s are not difficult to learn and understand. We will walk through the numbering systems used in PLCs. This includes Bits, Decimal, Hexadecimal, ASCII and Floating Point.
To get this free article, subscribe to my free email newsletter.
Use the information to inform other people how numbering systems work. Sign up now.
The ‘Robust Data Logging for Free’ eBook is also available as a free download. The link is included when you subscribe to ACC Automation.