MENU

Fun & Interesting

Ladder Logic Debugging: Solving Problems in PLC Programs

RealPars 20,684 1 year ago
Video Not Working? Fix It Now

▶ Want to learn industrial automation? Go here: http://realpars.com ▶ Want to train your team in industrial automation? Go here: http://realpars.com/business ▶ You can read the full post here: http://realpars.com/ladder-logic-debugging ⌚Timestamps: 00:00 - Intro 01:11 - Syntax errors 02:42 - Logical errors 04:04 - Timing and sequence errors 06:42 - Recommendations 07:48 - Conclusion Hello and welcome back to another free video from RealPars, the world's largest online learning platform for cutting-edge industrial technologies. In today’s video, we will show you how to debug common problems that you will encounter while programming, testing, and commissioning PLCs. After programming PLCs, the ability to test and debug code is the most important skill that a PLC programmer can have. Before being used in a production environment, all of your code has to be thoroughly tested to verify that it does what it is supposed to do in normal and abnormal situations like when a device fails. Any bugs found during this testing process must be solved since software bugs can lead to lost productive time, damaged products, and unsafe situations in a factory or plant. Let’s start by looking at the most common type of error that you will encounter: syntax errors. A syntax error is a mistake in the syntax, or wording, of your code. Most syntax errors are caused by programmers typing the name of a variable incorrectly. CODESYS is constantly checking your code for syntax errors while you work and any syntax errors are highlighted with a red squiggly line underneath the source of the error. Syntax errors are easy to find and fix because the CODESYS compiler highlights them to us. Logical errors are mistakes made by a programmer when writing his application logic. In this case, the syntax of the code is fine but the logic is not. Logical errors aren’t highlighted by the CODESYS compiler because the compiler doesn’t know how your logic should behave and therefore can’t tell you if it's wrong. Timing and sequence errors are a subset of logical errors that can cause a lot of difficulties for PLC programmers. A sequence error occurs when there is a problem with the sequencer and it does not activate the next sequential step or activates the wrong step. Very often, sequence errors are caused by timing errors. A timing error is a specific type of error that occurs because some variables don’t have the correct value at the correct time or the logic is not configured to check the correct variables at the correct time. To solve timing errors most PLC programmers will use a combination of techniques including; - trap bits which are test variables that are set to different values in your PLC program to see if a section of code is being executed, - traces which are graphs that show the values of a set of variables over time, and - breakpoints to stop the execution of a program at a certain time to see what values variables have and then execute the remainder of the program line by line to see where the error is occurring Solving errors can be very difficult and frustrating so the best thing you can do as a PLC programmer is write good code that doesn’t have any errors. Although it's not possible to write perfect code, you can increase the quality of your code and reduce the number of errors in your programs by; - Organizing your code well, - Following a descriptive naming convention, - Using rung and variable comments to document your logic, - Regularly having peers review your code to identify improvement areas, - Keeping regular backups to compare and revert logic if needed What other tips do you have to help reduce the number of errors in your PLC programs? Let us know in the comments. ============================= If you want to learn how to write error-free code, check out our course CODESYS 1 Introduction to PLC Programming: https://learn.realpars.com/courses/codesys-1-introduction-to-plc-programming ============================= Did you miss out on the latest and greatest? Catch up now by watching our videos right here: https://realpars.com/profibus-dp-network/ https://realpars.com/codesys-plc-programming/ https://realpars.com/ladder-logic-vs-other-languages ============================= TWEET THIS VIDEO: https://ctt.ac/GHcDa ============================= Follow us on Facebook 👉 https://www.facebook.com/therealpars Follow us on Twitter 👉 https://twitter.com/realpars Follow us on LinkedIn 👉 https://www.linkedin.com/company/realpars Follow us on Instagram 👉 https://www.instagram.com/realparsdotcom #LadderLogic #RealPars #plcprogramming

Comment