Tag Archives: plc programming example

PLC Programming Example – Palletizer Drum Instructions

How many ways can you program the PLC for the same function? The answer is allot of different ways. You can have ten different programmers working on the same program and get ten different automatic control PLC programs. Sure they may have similarities but, they are all unique in their code within the PLC. As a system integrator you will see many different ways of programming the PLC. We will now look at reprogramming our palletizer example using drum instructions. (Sequencer)
Last time we applied the five steps to PLC program development to a palletizer example. We will review our steps and then change our programming code to incorporate the drum instructions. Like our original example we will allow the operator to change the layers of boxes you want on each skid. We will also add in this example a manual operation sequence to cycle thought each of the steps for troubleshooting the program.

Developing the PLC program is a process that can be clearly defined. In our series on the five steps to PLC program development we have done some similar practical examples.
PLC Programming Examples – Five Steps to PLC Program Development
– Press
Process Mixer
Shift Register (Conveyor Reject)
Paint Spraying
Delay Starting of 7 Motors
– Pick and Place
– Sorting Station (Shift Register)
Palletizer

Define the task: (1)
Watch the sequence of operation video below. This will demonstrate the pallet layer selection, running and resetting of the machine.
Watch on YouTube : PLC Programming Example – Palletizer Testing
Continue Reading!

PLC Programming Example – Palletizer

We will apply the five steps to PLC program development to a palletizer example. Our example will allow you to determine how many layers of boxes you want on each skid.

Developing the PLC program is a process that can be clearly defined. In our series on the five steps to PLC program development we have done some similar practical examples.
PLC Programming Examples – Five Steps to PLC Program Development
– Press
Process Mixer
Shift Register (Conveyor Reject)
Paint Spraying
Delay Starting of 7 Motors
– Pick and Place
– Sorting Station (Shift Register)

Define the task: (1)
Watch the sequence of operation video below. This will demonstrate the pallet layer selection, running and resetting of the machine.
Watch on YouTube : PLC Programming Example – Palletizer Testing
Continue Reading!

PLC Programming Example – Sorting Station (Shift Register)

We will apply the five steps to PLC program development to a sorting station example. The program will use shift registers to track coloured parts down a conveyor and sort depending on colour into one of three locations.

Developing the PLC program is a process that can be clearly defined. In our series on the five steps to PLC program development we have done some similar practical examples.
Five Steps to PLC Program Development
– Press
Process Mixer
Shift Register (Conveyor Reject)
Paint Spraying
Delay Starting of 7 Motors
– Pick and Place

Define the task: (1)
Watch the sequence of operation video below.
Watch on YouTube : PLC Programming Example – Sorting Station Testing
Continue Reading!

PLC Programming Example – Pick and Place

We will apply the five steps to PLC program development to a pick and place robot example. The example will use a BRX PLC communicating to Factory IO (3D Software Simulator). Developing the PLC program is a process that can be clearly defined. In our series on the five steps to PLC program development we have done some similar practical examples.
Five Steps to PLC Program Development – Press
PLC Programming Examples:
Process Mixer
Shift Register (Conveyor Reject)
Paint Spraying
Delay Starting of 7 Motors

Define the task: (1)
Watch the sequence of operation video below.
Watch on YouTube : PLC Programming Example – Pick and Place Testing
Continue Reading!

Understanding the PLC Program Scan

Understanding how the PLC will scan and update your program is critical in programming and troubleshooting your system. Typically a PLC will solve your logic from left to right, top to bottom. The status of the memory from the previous rung, are available for the next rung to use. We will look at a few examples to determine how the PLC will solve logic to illustrate the above program scanning.  Keep on Reading!

PLC Programming Example – Delay Starting of 7 Motors

We will look at a PLC programming example of delaying the start of 7 motors. Each motor will be on a switch that the operator can select at any time. The motor outputs should have a 5 second delay between the outputs coming on.

This question originally came from PLCTalk.net. An original solution to the problem came from Peter Steinhoff. His solution is what we will be presenting. It is simple and straight forward.

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 directKeep on Reading!

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?
Conveyor Reject 0

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)
Inputs_Outputs

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.
Sequence Table

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.
Shift Register

Develop the PLC program:

Start and stop of the conveyor motor.
Program Conveyor Reject 1

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.
Program Conveyor Reject 2

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.Program Conveyor Reject 3

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.

Conveyor Reject

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:
https://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:

PLC Prgramming Example - Process Mixer
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.

Process Mixer - Sequence Table

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.Process Mixer Program 1

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.Process Mixer Program 2

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.Process Mixer Program 3

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.Process Mixer Program 4

5- Test the program

PLC Programming Example - Process Mixer

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.




Building a PLC Program That You Can Be Proud Of – Part 2

In part 1 we looked at writing PLC programs to control a traffic light using discrete bits and then using timed sequencing using indirect addressing.  We will now look at how we can use indirect addressing for inputs as well as output to control the sequence in the program.

Lets look at an example of controlling pneumatic (air) cylinders.

Video of  Pneumatic Cylinder Sequencing on YouTube.

This site contains a video of the three cylinders and the sequence required.

This program will have the following inputs. Even thought no sensors are mounted on the cylinders, it is best to have sensor inputs when the cylinder is extended (out) and retracted (in)
Inputs:
Cylinder 1 In – X1
Cylinder 1 Out – X2
Cylinder 2 In – X3
Cylinder 2 Out – X4
Cylinder 3 In – X5
Cylinger 3 Out – X6
Start PB NO – X7
Stop PB NO – X8
Step PB NO – X9

This program will have the following outputs.
Outputs:
Cylinder 1 In – Y1
Cylinder 1 Out – Y2
Cylinder 2 In – Y3
Cylinder 2 Out – Y4
Cylinder 3 In – Y5
Cylinger 3 Out – Y6

We will use the following pointers:
V0 – Output pointer starting at address V2000
V1 – Input pointer starting at address V1000
V10 will be the input word
V20 will be the output word

Before we start and write the code lets look at the sequence that we are trying to accomplish. The best way to do this is a chart indicating the inputs and output. I use either graph paper or a spreadsheet software to configure the sequence.
I usually start with the outputs configure the sequence that I would like to see. Then based upon the output sequence, I figure out the input sequence.

Note: Here is the location for a quick review of numbering systems from a previous post.

Once the sequence has been established, the next step is writing the program.
Input program that will set the input bits in V10.

Control part of the program:
The first scan will reset the input and output pointers.
The input pointer is compared to the input word V10. If they are equal then the output pointer and input pointer are incremented. If the STEP input is hit, then the output and input pointers are incremented.
The output pointer is then compared to the maximum value (end of sequence). If it is greater than or equal to the maximum value then the pointers will be reset.
Line 12 will move the outputs indirectly to the output word.

Output program that will set the actual outputs based upon the bits in V20

As you can see the actual program is very small however the sequence can be thousands of steps. This is a very straight forward and powerful method of programming. Programming this sequence using bits, timers and no indirect addressing would be very difficult and hard to read. Modifications would have to be a complete re-write of the program.

Modifications:
The entire program sequence could change without further lines of code. Only the values in the registers would need to be modified. This could lead to different sequences for different products.
We used a step input to have the program move forward through the sequence. It would be just as easy to add a step reverse function for the program. We would just have decrement the pointers and check to make sure when we were at the beginning of the sequence.

Troubleshooting:
When troubleshooting this program we would only need to look at the compares to determine what input and or output is not working correctly.

Integration with a touch panel display is simplified when using this type of programming method.

What other advantages do you see?

In Part 3 we will build on the traffic light sequencing used in part one with inputs for pedestrian and car detection.

Contact me for the above program. I will be happy to email it to you.
If you have any questions or need further information please contact me.
Thank you,
Garry

You can download the software and simulator free at the following address. Also listed are helpful guides to walk you through your first program.
Do-more Designer Software

How to use video’s for Do-more Designer Software




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.