PLC Programming Example – Shift Register (Conveyor Reject)

Allot of times 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 of a conveyor belt and reject station. Following the 5 steps to program development this PLC programming example should fully explain the function of shift registers. Ladder 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:

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 product on the conveyor belt and sensor A will detect 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 bad product. 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:

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 free wheel. 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 operation:

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: When power goes off and comes on the sequence will continue. This means that the shift sequencer must be memory retentive. Sensor 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. Clock input is used to shift the data through the shift register. In our example, we will be using the encoder on the conveyor 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 of 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 find out what the bit location will be at the reject location.

Test the program:

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 actually track the container as well as the rejects. You could also use bit shift right (BSR) and bit shift left instructions (BSR) to do the same thing as we did with the shift register instruction. In the Do-more PLC it is rotate left (ROTL) and rotate right (ROTR) instructions. Always check your instruction set of the controller that you are working with before starting to program.

Watch on YouTube : PLC Programming Example – Shift Register (Conveyor Reject)

Additional information on shift registers can be seen at the following URL:
http://accautomation.ca/plc-programming-example-sorting-station-shift-register/
This PLC programming example will look at sorting coloured tags into three different exits. The 3D simulation will use three different shift registers to trigger when to direct the correct colour tag.
Watch the sequence of operation video below.
Watch on YouTube : PLC Programming Example – Sorting Station Testing

If you have any questions or need further information please contact me.
Thank you,
Garry



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.

PLC Programming Example – Process Mixer

We will apply the five steps to PLC Program development to our next programming example of a process mixer.

1 – Define the task:


A normally open start and normally closed stop pushbuttons are used to start and stop the process. When the start button is pressed, solenoid A engergizes to start filling the tank. As the tank fills, the empty level sensor switch closes. When the tank is full, the full level sensor switch closes. Solenoid A is de-energized. Mixer motor starts and runs for 3 minutes to mix the liquid.  When the agitate motor stops, solenoid B is engergized to empty the tank. When the tank is completely empty, the empty sensor switch opens to de-engergize solenoid B. The start button is pressed to repeat the sequence.

2 – Define the Inputs and Outputs:

Inputs:
Start Pushbutton – Normally Open – On/Off
Stop Pushbutton – Normally Closed – On/Off
Empty Sensor Switch – On/Off
Full Sensor Switch – On/Off
Timer 3 minutes done bit – On/Off (Internal)

Outputs:
Mixer Motor – On/Off
Solenoid A – Fill – On/Off
Solenoid B – Empty – On/Off
Timer 3 minutes – (Internal)

3 – Develop a logical sequence of operation:

A flow chart or sequence table is used to fully understand the process.  It will also prompt questions like the following.

What happens when electrical power and/or pneumatic air is lost? What happens when the input / output devices fail? Do we need redundancy?

This is the step where you can save yourself allot of work by understanding everything about the operation. It will help prevent you from continuously re-writing the PLC logic. Knowing all of these answers upfront is vital in the development of the PLC program.

4 – Develop the PLC program

Since we need to continue the sequence when the power goes off then memory retentive locations in the PLC must be used. In our example we will use the ‘V Memory’ locations.

The first thing in our program is to control the start and stop functions. This is done through a latching circuit. From the sequence table we know that to reset the sequence we need to have the timer done and the empty sensor off.

The filling of the tank is done through Solenoid A. It is turned on by the start signal and off by the full sensor switch. (Sequence Table) You will notice that we have a memory retentive output and the actual output to active the solenoid.

The memory retentive timer will start timing when we have the start sequence signal and when the empty and fill sensors are on. The timer will reset when the empty and fill sensors are off. Mixing motor will be on when the timer is timing and when the timer is not done.

Solenoid B turns on to empty the tank when the timer is done and the full and empty sensors are on. It will reset when the empty sensor switch goes off.

5- Test the program

Test the program under many conditions. Check to see what happens when power is removed.

Using this five step to program development technique will shorten your programming time. The result will be a better defined logic and easier to understand program, because it has within the documentation the logic flow chart or sequence table.

Watch on YouTube : PLC Programming Example – Process Mixer

Factory IO provides a 3D simulation of the process. Testing of the program is important and should be done in a variety of ways. Factory IO provides a straight forward method of seeing your program in action before you wire your application.

We will be using the BRX PLC Modbus TCP Server (Slave). Factory IO will be the Modbus TCP Client (Master). When the tank fills up we will start a dwell time instead of the mixer time for the simulation.
Here is the mapping of the inputs and outputs using Factory IO.

Factory IO Website is at the following URL:
https://factoryio.com/
Documentation is well done. Start at the ‘Getting Started’ at the following URL:
https://factoryio.com/docs/

You can download the PLC program and Factory IO scene here.

Watch the following video to see this simulation in action.

Watch on YouTube : Process Mixer Test Simulation
If you have any questions or need further information please contact me.
Thank you,
Garry



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.

Five Steps to PLC Program Development

Programming a PLC can sometimes be a daunting task. The best method is to break the task into some smaller steps. These are the steps that I have used for years. We will apply them to a die stamping application.

1 – Define the task:

What has to happen?

A master switch is used to start the process and to shut it down. Two sensors: an upper limit switch that indicates when the piston is fully retracted and a lower limit switch that indicates when the piston is fully extended. When the master switch is turned on the piston reciprocates between the extended and retracted positions. This is achieved with an up and down solenoid. When the master switch is turned off, the piston returns to the retracted position and all solenoids are off.

2 – Define the Inputs and Outputs:

Inputs:
Master Switch – On/Off
Upper Limit Switch – On/Off
Lower Limit Switch – On/Off

Outputs:
Down Solenoid – On/Off
Up Solenoid – On/Off

3 – Develop a logical sequence of operation:

This can be done with the use of a flow chart or sequence table. You can use anything to fully understand the logic of the operation before programming. Many people do not use this step and jump straight to programming.

Fully understanding the logic before starting to program can save you time and frustration.

Sequence Table: The following is a sequence table for our die stamping application. I usually review this sequence with the person with the most knowledge of the machine. This can be the designer and / or the machine operator.

How to read the Sequence Table: Follow the steps from left to right, top to bottom. Inputs and outputs are labelled as 1 (ON), 0 (OFF) or X (Does not Matter). Step 1 indicates that it does not matter the upper and lower limit switch positions. The master switch is off, so the up and down solenoids are off. Steps 3 and 4 repeat themselves as long as the master switch is on.

Note: You will notice that at step 2, after the master switch turns on the up solenoid will be activated. So the piston always retracts when the master switch is first turned on.  This operation was picked up in development of our logical sequence.

4 – Develop the PLC program:

Look at the sequence table in respect to the following logic. I have used Set and Reset conditions so it is easily followed by the sequence table. When the master switch turns on the up solenoid is activated. Notice the first rung is a direct correlation. Follow the rest of the sequence table with this ladder logic.


Document, Document, Document This is a vital part of every program, which will save you time and money when you have to return to the program years later.

5 – Test the program:


Test the program with a simulator or actual machine. Make modifications as necessary. Check with the people most knowledgeable on the machine, to see if it is doing what they expect. Do they need something else? Follow up after a time frame to see if any problems arise that need to be addressed.

These five steps will help you in your PLC programming.

  1. Define the task
  2. Define the inputs and outputs
  3. Develop a logical sequence of operation
  4. Develop the PLC program
  5. Test the program

The five steps form the basis of all PLC development. You will notice that the actual programming does not occur until the second last step. Usually more time is spent on understanding the task and sequence of operation.

Watch on YouTube : Five Steps to PLC Program Development
If you have any questions or need further information please contact me.
Thank you,
Garry



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.