Ladder Logic Debugging: Solving Problems in PLC Programs

  Рет қаралды 18,886

RealPars

RealPars

Күн бұрын

▶ The easiest way to learn industrial automation:
realpars.com
▶ You can read the full post here:
realpars.com/ladder-logic-debu...
⌚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: learn.realpars.com/courses/co...
=============================
Did you miss out on the latest and greatest? Catch up now by watching our videos right here:
realpars.com/profibus-dp-netw...
realpars.com/codesys-plc-prog...
realpars.com/ladder-logic-vs-...
=============================
TWEET THIS VIDEO: ctt.ac/GHcDa
=============================
Follow us on Facebook 👉 / therealpars
Follow us on Twitter 👉 / realpars
Follow us on LinkedIn 👉 / realpars
Follow us on Instagram 👉 / realparsdotcom
#LadderLogic #RealPars #plcprogramming

Пікірлер: 12
@motema_mpembe
@motema_mpembe 8 ай бұрын
This is informative. Another way to keep track of the Project Versions is to use Version Control Systems. This will prevent keeping numerous and poorly documented backups. Great content.
@realpars
@realpars 8 ай бұрын
Thank you very much! We truly appreciate that
@IngDzib
@IngDzib 9 ай бұрын
Thanks, Regards from Cancun
@mw3blackopsglitches
@mw3blackopsglitches 9 ай бұрын
Mov and Equ is good for sequence steps for AB and to have fault state returns when a fault happens
@42-chaitanyaparekh48
@42-chaitanyaparekh48 8 ай бұрын
Can you provide some information regarding vacuum compatible motors. The motors should work under 10^-7 mbar pressure.
@realpars
@realpars 8 ай бұрын
Thanks for your comment! I will happily go ahead and share this with our course developers as a topic suggestion. Thank you again, and happy learning!
@MR-backup
@MR-backup 8 ай бұрын
"vacuum compatible motors" - What?
@iascsampla3415
@iascsampla3415 9 ай бұрын
Offline courses are available?
@realpars
@realpars 9 ай бұрын
Hi there, Unfortunately, we currently do not provide any offline courses.
@rockyrivermushrooms529
@rockyrivermushrooms529 9 ай бұрын
3:28 what will usually happen is the machine will get shipped then you will get stuck debugging someone else's code at the factory of a ticked off customer.
@pavunumuthu9510
@pavunumuthu9510 9 ай бұрын
I fully intrest in topics so help me sir.
Visualization Options for CODESYS
8:15
RealPars
Рет қаралды 7 М.
What is HART Protocol?
17:01
RealPars
Рет қаралды 1 МЛН
WHO DO I LOVE MOST?
00:22
dednahype
Рет қаралды 18 МЛН
DELETE TOXICITY = 5 LEGENDARY STARR DROPS!
02:20
Brawl Stars
Рет қаралды 22 МЛН
Khóa ly biệt
01:00
Đào Nguyễn Ánh - Hữu Hưng
Рет қаралды 19 МЛН
Ladder Logic Best Practices: Optimizing Your PLC Programs
9:46
What is the Difference Between PLC and DCS?
11:23
RealPars
Рет қаралды 1,2 МЛН
everything is open source if you can reverse engineer (try it RIGHT NOW!)
13:56
Low Level Learning
Рет қаралды 1,3 МЛН
PLC Basics: Ladder Logic
26:20
This is Automation
Рет қаралды 341 М.
Rule #1 for Programming PLCs
33:00
plcprofessor
Рет қаралды 41 М.
What is Ethernet/IP?
8:06
RealPars
Рет қаралды 487 М.
Programable Logic Controller Basics Explained - automation engineering
15:11
The Engineering Mindset
Рет қаралды 1,9 МЛН
What is Data Center Infrastructure? - Data Center Fundamentals
30:00
datacenterHawk
Рет қаралды 113 М.
"I Hate Agile!" | Allen Holub On Why He Thinks Agile And Scrum Are Broken
8:33