Subscribe and listen to AW’s podcast!
Subscribe and listen to the Automation World Gets Your Questions Answered podcast!
Listen Here

It’s 2 a.m. Sunday—Can You Troubleshoot Your PLC Code?

Let’s help the maintenance technicians and control engineers who get hauled out of bed in the middle of the night by creating code that is easier to troubleshoot.

Scott Baker, Avanceon
Scott Baker, Avanceon

I’m writing this blog on behalf of the maintenance technicians and control engineers who get called in the middle of the night to figure out why the line won’t run. They didn’t write the code. They have had no need to study it closely. Now the line is down, people are standing around, the plant manager is getting impatient, and they need to figure out what’s wrong.

Here are some tips on how we can help them out when we are creating the programmable logic controller (PLC) code:

  • Organization—Take the time to lay out the tasks, programs and routines in a logical manner that is easy for someone else to follow.
    • Lay out program files to match process areas. Order them to match the process flow.
    • Create separate routines to capture separate functions. Don’t try to cram everything into one routine.
    • Lay out your routines in a logical manner to group similar functions together.
    • When writing your logic, try to develop your timers before you use the results of the timers. Try to keep your latches and unlatches in the same area. Try to use a rung for only a single function.
  • Terminology—Use terminology that matches what the plant is using. It will be easier to support if you use the same name for the equipment that the technician uses.
  • Documentation—Document everything. Rung comments and tag descriptions can be amazingly helpful when you write them properly. Explain what is going on in the rung, especially when you are doing anything that might be complicated or confusing. If you need to do a calculation, explain why. Explaining why and how can go a long way.
  • Structure—There are often several ways to get something done. You can use ladder logic, sequence flow charts or structured text. Within ladder logic, there might be different ways to accomplish your intent. Some are more efficient to program; some are more efficient when executing. Consider using a method that is most efficient to troubleshoot.

Let’s help out the folks who get called in the middle of the night and want to get back into their warm beds as quickly as possible.

What other tips do you have?

Scott Baker is the business unit director/principal engineer at Avanceon, a certified member of the Control System Integrators Association (CSIA). For more information about Avanceon, visit its profile on the Industrial Automation Exchange.


How use of robotic technology is sweeping across all industries
We asked nearly 60 industrial end-users and system integrators about their use of robotic technology. This report details the trends they identified and how to compare different types of robots.
Download Now
How use of robotic technology is sweeping across all industries
Discover New Content
Access Automation World's free educational content library!
Unlock Learning Here
Discover New Content