The Machine Simulator (MS) is part of the EasyPLC software suite. It has many built-in machines that are used to show different programming techniques. The paint line is one of these machines. It will use a bit shift (shift register) to track bottles along a conveyor belt. All the bottles will be detected using photocells and tracked along the conveyor. Larger (taller) bottles will be painted and then pushed into a box at different sections of the conveyor belt. A control panel will be used to start and stop the paint line and display the bottle count. The paint line machine simulator is an excellent way to learn how to program shift registers (bit shift) in the PLC.
The BRX Do-More PLC will be used to program this virtual paint line machine. Using the BRX Do-More PLC, we will connect to the paint line machine. This will be done using Modbus TCP (Ethernet) for communications. Using the five steps for program development we will show how this is programmed. Let’s get started.
In part 1 we added additional discrete digital inputs and outputs modules (cards) to our P1AM-START1 (Industrial Arduino) ProductivityOpen starter kit with Ethernet. A program was then discussed that will print the modules in our system and then set and reset discrete digital inputs and outputs. P1-16TR – Productivity1000 relay output module, 16-point, 6-24 VDC/6-120 VAC, (16) Form A (SPST) no-suppression, 2 isolated common(s), 8 point(s) per common, 2A/point, 8A/common. P1-16CDR – Productivity1000 discrete combo module, Input: 8-point, 24 VAC/VDC, sinking/sourcing, Output: 8-point, 6-24 VDC/6-120 VAC, relay, (8) Form A (SPST) relays, 1A/point. P1-08SIM – Productivity1000 simulator input module, 8-point.
We will now discuss additional instructions in our industrial Arduino controller that will be used with our P1000 (P1) expansion modules. (cards) Our sample sketch will include a simple start/stop circuit and a shifting circuit.
Let’s get started.
We will use the PLC to sort items on a conveyor operating shift register instructions. We will apply the five steps to a PLC example program development of a sorting station. The program will use shift registers to track colored parts down a conveyor and sort, depending on color, into one of three locations.
We apply the five steps of PLC development to a plc shift register example. This PLC programming example will use a shift register to reject a product on a conveyor.
When programming a PLC, you need to track what has previously happened. Shift registers allow you to do just that. We will look at a PLC basic tutorial on a conveyor belt and reject station. Following the five steps to program development, this PLC programming example should fully explain the function of shift registers. Ladder logic will be our PLC programming language.
We will be using the Do-more Designer software, which comes with a simulator. This fully functional program is offered free of charge at automation direct.
Define the task:
Shift Register – Conveyor Reject
What has to happen?
A start pushbutton (NO) is used to start the conveyor, and a stop pushbutton (NC) is used to stop. Sensor B detects a product on the conveyor belt, and sensor A will see if it is too large and needs to be rejected. The product is tracked along the conveyor belt, and when under the reject station, the Reject Blow Off will expel the wrong product. The product is randomly placed on the conveyor belt, so an incremental encoder is used to track the conveyor movement. The reset pushbutton (NO) will signal that all of the product on the conveyor has been removed between the sensors and reject blow-off.
Define the Inputs and Outputs:
PLC Connections for the Shift Register Conveyor Example
Inputs: Start Switch – On/Off (Normally Open) – NO Stop Switch – On/Off (Normally Closed) – NC Reset Switch – On/Off – NO Motor Encoder – On/Off – This will give a discrete signal when the conveyor is moving. It picks up the movement of the freewheel. Sensor A (Part Reject) – On/Off – NO Sensor B (Part Present) – On/Off – NO
Outputs: Motor – On/Off (Conveyor Run) Air Blow Off – On/Off (Reject)
Develop a logical sequence of operations:
PLC Logic for Shift Register Conveyor Reject
Fully understanding the logic before starting to program can save you time and frustration.
Sequence Table: The following is a sequence table for our conveyor reject application.
It is a simple sequence table but clarifies the following: The sequence will continue when the power goes off and comes on. This means that the shift sequencer must be memory retentive. Sensors A and B must be on to get tracked with a shift register.
Shift Registers: The Shift Register (SR) instruction shifts data through a predefined number of BIT locations. These BIT locations can be a range of BITs, a single Word or DWord, or a range of Words or DWords. The instruction has three inputs. Data, Clock, and Reset. The data input will load the beginning bit with a ‘1’ if it is on or ‘0’ if it is not. The clock input is used to shift the data through the shift register. In our example, we will use the conveyor’s encoder to track the reject container. So each pulse of the clock represents a distance on the conveyor. The last input is the reset. It will place ‘0’ in all of the bits within the shift register.
Develop the PLC program:
Start and stop the conveyor motor.
Shift register to track the rejected parts. This will move the bits with each pulse of the encoder. Note that the ‘V’ memory is used because it is memory retentive.
This will look at the bit in front of the reject station. We can measure and count off the length (conveyor) and then determine the bit location at the reject location.
Test the PLC program:
Shift Register Conveyor Reject
Test the program with a simulator or actual machine. Make modifications as necessary. Remember to follow up after a time frame to see if any problems arise that need to be addressed with the program.
Notes: Sometimes, you can use multiple shift registers in your program. This can be helpful if you want to track the container and the rejects. You could also use a bit shift right (BSR), and bit shift left instructions (BSR) to do the same thing as we did with the shift register instruction. The Do-more PLC rotates left (ROTL) and rotate right (ROTR) instructions. Always check the instruction set of the controller you are working with before starting the program.
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 PLCs are not challenging 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 for free download. The link is included when you subscribe to ACC Automation.