And what happens when you hit a break point? Does the whole machine stop or does it run open loop?
This is a problem when debugging anything that moves.
The program stops, set outputs stay high or low. If something is in motion, it will potentially stay in motion. The current line of code where the breakpoint is set is highlighted in yellow, then you can step though/over it.
Setting a break point in the PLC program
Yes, it can be done but it isn't always safe when things are moving or when a burner can be left on etc. What makes sure the outputs are in a safe state?
Setting break-points in a PLC program (TwinCAT) can be done and that debugging tool is available to the developer to use if he/she wishes. It's up to the developer to ensure everything is safe before setting break points, but that should go without having to be said. It's no different then making online edits, forcing outputs, etc. It's up to the developer to make sure its safe before doing these things. The TwinCAT Debugging documentation on setting Break Points is also
very explicit about this:
https://infosys.beckhoff.com/english.php?content=../content/1033/tc3_c/1028235531.html&id=
I sometimes use break-points when debugging, but its always within one of two scenarios:
1. 95% of the time when using Break Points, I only use them when debugging a fresh program or algorithm (function, function block, etc) on my laptop. Recall, because it's TwinCAT, I can run a PLC runtime on my laptop without the need for physical PLC hardware. So setting break-points in this scenario has 0% potential of hurting anything or anyone!
2. The remaining 5% of the time, I only use break-points in a real PLC that is controlling a machine when the machine is down and not in use, and I have full reign to that machine. Still, I rarely use break points on a live machine.
What about array indexes going past the end or beginning of an array?
Can't say. I avoid using pointers. I can try it out on my laptop and report back though. I suppose you could too