PLC Programming Errors and Oversights - Part 2
In our last installment of the Practicing PLC Technician Series, we examined some of the common approaches used when programming PLCs for industrial applications. In this installment we will examine some of the most common programming errors and oversights that occur when working with the instructions we have covered to date in our ongoing series. Here are some basic programming oversights and issues to watch out for.
Three common programming oversights encountered when working with coils and contacts?
1. One of the most common errors made when working with coils and contacts occurs when program logic on one rung in a program instructs an output to be in a given state, while conditions on a different rung in the program instructs the same output to be in the opposite state during a single scan cycle. Care must be taken to ensure that conditions cannot arise that have an output instruction being set to two different states (ON/OFF) during a single scan cycle. Use of a status flag as an intermediary step is one possible solution to this type of situation.
2. Another situation to be sure to avoid pertains to field devices. For instance, if two motors are being used in an application, program logic must ensure that the motors are not working at cross purposes or having a valve open to drain a tank at the same time a pump is running to fill it. Mutual exclusivity must be maintained between outputs in these types of situations. This issue is often resolved by using programmed interlocks ensuring that one of the outputs must be off in order for the other to be on.
3. Care must be taken when using subroutines to ensure that output states are not fixed by a subroutine that is no longer being scanned. In this situation, an output is turned on or off inside a subroutine that is selectively called. If program execution leaves the subroutine, and that subroutine does not get scanned again (a change in conditions results in the subroutine no longer being used), any attempt to change the state of that outputs state by rungs outside of the subroutine will result in a program conflict similar to that mentioned in point 1 above. In this instance, passing a variable in and out of a subroutine instead of directly addressing physical outputs can help to ensure this does not occur
Common difficulties using timers in PLC programming?
common error arises when working with timers in cases where the scan cycle of a given program represents a significant part or portion of a timed duration set on a timer in the application. In this situation, accurate tracking of the timer is adversely affected. The timer will not be updated quickly enough to catch or come close to the “preset” time due to the amount of time it takes to complete a single scan cycle. This issue often arises when a particular program is large and not compartmentalized/optimized, or when the desired time duration is very short. When these conditions are causing adverse affects to your application, you should place copies of the timer rung in different places in the program to ensure that the timer accumulated value is updated more than once per scan cycle.
Frequent oversight working with counters
One of the most often overlooked issue when working with counters relates to the limited maximum and minimum values that a counter can reach. Provisions must be made of overflow and/or underflow when working with counters. In some instances, negative counter accumulated values can cause undesirable events in a given PLC application. This can often be the case when working with ranges of “accumulated” values. If the counter wraps around, its accumulated value can often fall outside the specified ranges of operation in an application. Be sure to put the overflow and underflow bits to good use in ensuring when this wrap around situation has occurred, and use them to address it.
Two misunderstood aspects of using sequencers
1. When using sequencers in PLC applications, the details of how masking works can often be misunderstood. Selecting the appropriate mask value is critical in ensuring data table output, or data acquisition is accomplished. Often, beginners believe that the use of a mask ensures only certain portions of a data word can be modified. While this is true in a sense, the entire word gets overwritten or filtered, not just the portion included in the high bits of the mask value. Bits that are low in the mask word will be low when the destination word is overwritten. This can often be somewhat counter intuitive to the beginner. It is more accurate to say that only bits corresponding to the high bits in a mask word can take on the source word value, all bits in that are low in the mask word will cause the destination to take on a low value in the destination. If the original data is to be preserved, high bit values must be used to ensure that the mask does NOT filter or change the outgoing value.
2. When referencing the location from which data is to come from, or be stored to, it is important to note that the memory location referenced is actually a place holder for the array pointer. It is not actually part of the data table being constructed or being read from. It is important to note that when the sequencer wraps around, the first location in the data table is actually the next consecutive file address. For instance, if the file field has an address of B3:1, the first address in the table to get or send out data would be B3:2 in this instance. Furthermore, the Length field value specified, does not include the referenced file location itself, but the number of steps or memory locations immediately after the referenced address.
To get a better handle on PLC programming for beginners, check out the PLCLogix simulation software package. Watch our video for a brief overview of what this RSLogics compatible software has to offer. It is a great way to gain an understanding of ladder logic programming and features 10 real world 3D application environments to work with.
If you like this post, check out our other posts in the Practicing PLC Technician Series.
We hope that this has been helpful as a student or practicing PLC technician. We are looking for other ideas for the Practicing PLC Technician Series. Please let us know if you have any ideas that you would like to see and send your thoughts to email@example.com