At AboutMechanics, we're committed to delivering accurate, trustworthy information. Our expert-authored content is rigorously fact-checked and sourced from credible authorities. Discover how we uphold the highest standards in providing you with reliable knowledge.

Learn more...

What Are the Best Tips for Programmable Logic Controller Programming?

Lakshmi Sandhana
Lakshmi Sandhana

Programmable logic controllers are small computing devices used in factories and the industrial field to run machinery. Equipped with their own operating systems, programmable logic controllers (PLCs) control the processes used to manufacture products. Programmers alter the processes on PLCs to operate machinery and make changes in the product being manufactured. They use programmable logic controller programming in areas like machining, food packaging, and materials handling. Some of the best tips for programmers are using a one shot, implementing a proportional controller in the logic, making toggling logic, and reducing PLC scan time issues.

The one shot feature is handy to have when a condition switches between on and off and the PLC must take action on the true state for only one scan. The coil goes true every time the enabling ring is true, and it all stays true for only one scan. At times, the order of the rungs becomes important in a one shot because the PLC needs to complete a full scan when the output bit is on and only then sees the first rung.

A programmable logic controller.
A programmable logic controller.

Incorporating proportional controllers into a PLC becomes very useful in programmable logic controller programming, especially when it doesn't have built-in proportional/integral/derivatives or PID instructions. PID controllers are process controllers that have special tunable response characteristics. This allows them to properly execute control algorithms that anticipate and measure process heating and cooling rates and auto correct. Process control procedures use proportional controllers in a myriad of ways; having total control of the heating is a popular application. PLCs can be programmed precisely to turn the heater on or cycle it on and off.

A popular method in programmable logic controller programming uses the concept of toggling. This logic is useful when the programmer needs to have one button to control a device with the same toggling action. For instance, pressing a button once turns the device on, and pressing it again turns it off. This logic switches from the off state to the on state when the input becomes true. It then stays on until the input becomes false.

Long PLC scan times can also be an issue in programmable logic controller programming, especially when designing controls for high-speed machines. A popular approach uses incremental encoding to calculate the machine's position. This approach, however, can cause a lot of problems when trying to make the machine run faster. If the output from the encoder working at the increased speed goes from false to true and back in the time it takes for the PLC to make one scan, then the counter does not count properly. This causes the machine to crash or the moving parts to lose synchronization when the speed is turned up.

The solution in such a scenario is to use an absolute position encoder instead of an incremental encoder. The advantage of this type of encoder is that it is less susceptible to errors as the speed of the machine increases. This encoder, though, requires around a dozen or more input lines compared to the two lines an incremental encoder needs. Absolute encoders also can produce errors like missed states, where some of the bits change and others don't. If skipped states occur with an absolute encoder, then it needs to be replaced with another.

Discuss this Article

Post your comments
Forgot password?
    • A programmable logic controller.
      By: dneez
      A programmable logic controller.