Tag Archives: plc programming videos

How to Make a One Shot in the PLC

A one shot in the PLC will turn an output on for one scan. This is used to trigger events that should only happen once. An example of this would be to increment a value in memory. If a one shot is not used, then every scan of the PLC will increment the value.

One shots are known by several other names. Differential Up (DIFU), Differential Down (DIFD), One Shot Relay (OSR), Powerflow Modifier, Leading edge contact, Trailing edge contact, etc. This all relates to the programmable controller that you are programming.

Lets take a look at programming a one shot using bit logic only. We will program both a leading edge one shot and a trailing edge one shot bit. This program will work in all PLCs.
Note: The white background in the increment (INC) instruction just indicates the reset for the animation.

One Shot Bit Leading EdgeLeading edge one shot bit: This will turn on a bit for one scan when the input condition makes a transition from 0 to 1. (Off to on)
When input X0 turns on C0 is turned on for one scan. This is because it is in series with the C1 lead work bit. The next rung will latch this on and not unlatch it until the input condition X0 turns off. C0 will only be on for one scan when X0 turns on.

One Shot Bit Trailing EdgeTrailing edge one shot bit: This will turn on a bit for one scan when the input condition makes a transition from 1 to 0. (On to off)
When input X0 turns off C2 is turned on for one scan. This is because it is in series with C3 trail work bit. The next rung will latch this on and not unlatch it until the input condition X0 turns off.

The Do-more PLC has several different ways to do the leading and trailing edge one shots. Here are a couple:

Leading and Trailing Edge Contact

The leading or trailing edge contact instruction will allow logic flow for one scan from a transition. (On to off / Off to on)

Leading and Trailing Edge Powerflow Modifier

The leading and trailing edge Powerflow Modifier is placed before the output. It will turn multiple input signals into a one shot for the output.

Watch on YouTube : How to Make a One Shot in the PLC
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.

Creating a Flip Flop Circuit in the PLC

A flip flop curcuit in a PLC usually has one input and two outputs. When the input is activated, the two outputs latch on/off opposite to each other alternately.  Basically it is used to toggle (latch) an output on and off with just one input. In the PLC it is a single input that will toggle an output on and off each time the input signal is activated.

Here is an example of a hard wired flip flop circuit using relays.
C9C_pulse_toggle_relays

The PLC program will be a little different than the relays because of the way in which the PLC scans. Scanning takes place from left to right, top to bottom. The output conditions from the logic are available to the next rung as the logic is solved. Outputs and inputs are read usually only once at the end of the scan. Remember to think of the outputs in the PLC as make before break. This is the opposite of the relay logic presented above which is break before make.

Lets look at the logic. This is programmed using the Do-More Programming Software which comes with a simulator. This full programming package is free of charge and can be downloaded here.

Flip Flop PLC Circuit 1

The input is on a leading edge instruction. (One Scan) If output 2 is on then it will set output 1. If output 2 is not on then it will reset output 1. The third line of code will determine the state of output 2 based upon output 1.

You may be asking yourself why do we not just use the conditions from output 1 to control output 1.  This is because if we substituted output 1 for the conditions on the input then the output 1 would never turn on/off. The output conditions are available for the next line of PLC code. This would allow the output to be set and reset within the scan without being updated. Using output 2 is the only way in which this logic would work.

Here is an automated picture to show the input toggling on / off and the outputs flip flopping.

Flip Flop PLC Circuit S

Note: An emergency condition can be added to the set or reset rungs to automatically control the output either way.

Watch on YouTube : Creating a Flip Flop Circuit in the PLC
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 3

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. Part 2 used indirect addressing for inputs as well as output to control the sequence of pneumatic (air) cylinders in the program. We will now return to the traffic light application and expand our program significantly.

Let’s build on the traffic light sequencing used in part one with inputs for pedestrian and car detection. We will also throw in the time of day so that during weekday peak hours an advanced arrow will be used. Advanced green (flashing) will be used when the traffic is detected in the turning lane during the off peak hours.
Pedestrian Walk Signals Traffic Light with Turn

Programming using this method of sequencing requires allot of time up front before we start the actual PLC program. However this method makes the program easier to understand, troubleshoot and modify in the future.

Remember that the PLC programmer must know everything about the machine and operation before programming.

If we just start writing code, then we will constantly be correcting and modifying based on trial and error. I use a spreadsheet program to plot out the inputs, outputs and mask tables. We will go into the details of this below.

Lets look at the inputs:
Sequencer Inputs

We set up the input table in words V0 to V499. Each bit in the table will be compared to the signals coming the actual signals wired or programmed in the PLC.
Bit 0 is the time input which will control the entire program interval. Next we have the Car Detection signals on Bits 1 to 4. The pedestrian signals are pushbuttons coming from Bits 5 and 6. The left turn signals are located in Bits 7 to 10.  The real time clock functions will come from Bits 12 to 15.

Lets look at the outputs:
Sequencer Outputs

The output table will be in words V1000 to V1499. The input word will be compared to the actual inputs and the corresponding output channel will be moved to the actual outputs. All of the output bits control lights. You will notice that there is a green light for each direction. This will give us the greatest flexibility when writing our PLC program. Pedestrian signals have a flashing output bit and just an output bit. There will be only one output but this bit will determine if it is flashing or not.

Masking Inputs:
Sequencer Mask

The masking table will be in words V500 to V999. The masking bits will correspond directly to the input table bits. Using the mask will allow us to ignore the status of certain bits when using the compare instruction and setting the outputs.

The Mask table will be used by using an ‘AND’ word instruction. If the mask bit is on for the input then it will be used in the compare instruction. If the mask bit is off for the input then the value is always off using the compare.
Example:
1 ‘AND’ 1 = 1
1 ‘AND’ 0 = 0
0’AND’ 1 = 0
0 ‘AND’ 0 = 0

Once we have this all laid out in the spreadsheet, we can start filling out our sequence of events. Fill in the events based upon the time frame from input bit 0. I usually start by thinking about what happens when power is applied to the unit the first time. This exercise can be a struggle because you must know exactly what you want the sequence to be in order to fill out the table.

We will continue this next time by writing the code to do what our tables want. A review of the numbering systems can be found on this post. A copy of the spreadsheet can be obtained at the following link: PLC Traffic Sequence

Part 4 will continue with the programming of the logic in the PLC.

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.

Here is a Method That is Helping PLC Programmers to Program Faster

PLC programming involves both direct and indirect addressing. Direct address programming involves writing each ladder logic rung to do the operation required. We often forget about using the powerful indirect addressing to solve our logic.

The below animated picture will show a simple example of using indirect addressing. This will use the MOVE instruction and transfer a word indirectly to output word V100. V[V0] means that the value in V0 will point to the V memory to get the value to move. You can think of this as a pointer for the memory location to move.

Indirect Addressing Animation

Of course we need to monitor V0. Our values are in sequence from V1 to V6. We need to ensure that V0 is always in the range from 1 to 6.

Lets take a look at a program sample using the Do-more Designer Software. We will set up the sequence similar to the animation above, but expand the program.
Just like above we will set up the pointer at V0 and the output at V100 memory locations. V1 to V37 will hold our output data sequence. This is outputs that we want to set on each event and/or time frame. You can see some of the registers and the corresponding values. These are set as a hexadecimal value. The following link will provide a review of the numbering systems in the PLC. (WHAT EVERYBODY OUGHT TO KNOW ABOUT PLC (PROGRAMMABLE LOGIC CONTROLLER) NUMBERING SYSTEMS)

Indirect Addressing 4 Data

This is the logic to set up the move instruction. The source is V[V0] which means the pointer is V0 in this memory area. The destination will be V100.

Indirect Addressing 1 MOV

An internal timing bit ST5($100ms) is used to increment the pointer V0. This could also be done by an event or series of events. The pointer is then compared to ensure that it is between 1 and 37.

Indirect Addressing 2 Pointer

Finally the output word is then transferred to the physical outputs. This is done by using the MAPIO instruction. Each bit can be set independently.

This example uses indirect addressing to program a sequence based upon time. We could just as easily used indirect addressing to compare inputs to a table and set the outputs accordingly. You can see how this method can greatly reduce the amount of time to develop your program. This holds especially true if the sequence needs to be changed. It would be just a matter of changing data values in the table.

The following are separate posts that use indirect addressing:

Building a PLC Program You Can Be Proud Of – Part 1
This use the control of an intersection traffic light to demonstrate direct versus indirect addressing.

Building a PLC Program That You Can Be Proud Of – Part 2
A sample program to control valves. This uses indirect addressing for the inputs as well as the outputs.

Now You Can Have Robust Data Logging for Free – Part 1
Using indirect addressing, this sample program will log information in the PLC to be retrieved at a later time.

Indirect addressing is a powerful method of programming to simplify and program faster than you ever thought possible. You can even use indirect addressing in the PLC to scale a non-linear analog input signal. Let me know you thoughts on using indirect addressing. What can you come up with?

Watch on YouTube : Here is a Method That is Helping PLC Programmers to Program Faster

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.

The Secret of Using Counters

funny_counter

Counters  are used in the majority of PLC programs. This is especially true if part of your SCADA system. Counters like the animated picture above count things. In this situation we are counting the number of turns the little guy makes. The counter is displaying the total number. This is considered a totalizing counter. If an output turned on to do something then it would be a preset (target number entered for the count) counter. There are also a wide variety of off the shelf industrial counters that you can use. The implementation of counters can be vast, however it all starts with a TIMING CHART. This is the same as the timing charts we discussed in ‘The Secret of Timers’ post.

A timing chart is the secret behind understanding of the counter that you need in your application. Making a timing chart before writing the program will ensure that all of the information will be accounted.

The timing chart is mapped out on a x and y plain. The ‘y’ plain has the state of the input on/off (1 or 0). The ‘x’ plain will show time.

The following shows a timing chart for a counter:
timing chart counterAs you can see in this timing chart, you have an input, output and display.

Inputs:
Inputs are used usually sensors that are wired to the counter (PLC) to indicate the items that we need to count. They can be switches, photoelectric sensors, proximity sensors, encoders, etc. (Wiring of NPN / PNP devices) A counter will generally have only one input. In the case of an encoder input it is still only one input, however this is wired usually as a A, B and Z phase. Z is always the reset. A and B indicate the pulses and are leading or trailing each other by 90 degrees depending on direction. Allot of counters will also allow you to as a direction input signal. However this is all still only one input.
Output ModesInput Modes

Outputs:
Outputs from counters are generally discrete. This means that they are on or off, similar to the inputs. Outputs will trigger when the count value matches the set value. The duration that the output is on depends on the reset signal, to start the count again. (DC Solenoids protection) Allot of the counters today will allow you to have multiple outputs. These multifunction counters can have several preset outputs that trigger when the counter set value has been reached. Batch outputs are also available on some of the industrial counters. A batch output counts the number of times that the preset has been reached. This output will be turned on when the number entered for the batch has been reached.

Set Value – SV:
This is usually on the display and shows the preset value. It is the target number of counts.

Present Value – PV:
This is usually on the display and shows the current or accumulated value.

Roller Measurment

The PLC programming is usually not that much different then the industrial counter. Allot of the manufactures will have an up counter, down counter and/or an up/down counter. Just as the name implies the display is either counting up or down. You have to refer to the instruction manual of the manufacturer you are programming for the way in which the counter will be programmed.

Do-More Up and Down Counter

In the above example Do-More PLC program we have an up and a down counter. X0 is the input and X1 is the reset on both of these counters. (CT0, CT1)
The preset value is stored in memory location D0. This value is set to the number 3.
When the present value (accumulated) reaches the set value (preset) then the CT0.Done bit goes on and the output Y0 is active. Y0 will remain on until the reset input goes on.
The only difference for down counter is the display. You will see that the present value will count down to zero (0) before the CT1.Done bit is turned on.
These counters are memory retentive. So in order to make the counter non-memory retentive, use the first scan bit of the PLC to trigger the reset of the counter. (ST0 – $FirstScan)

Every PLC has counters. They all have different types depending on what you are trying to achieve. It will all start with your Timing Chart.

Watch on YouTube : Learn PLC Programming – Free 9 – The Secret of Counters

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.