kortenbach
[203128%2F9262743%2Fmceclip0]
Simple question: Does RunFirst run first and RunLast run last??
I think it doesn't. Is the execution order undefined or maybe from bottom to top?
If this list doesn't control the execution order then what does?
Reply 0 0
thiagoralves
Yes, they are executed according to the order you define in the table. See https://openplc.discussion.community/post/how-to-set-priority-13534176
Reply 0 0
kortenbach
Thanks for your (very) quick reply!
In my application RunLast resets a bit called "FirstCycle".
This bit is initialized to true in the global table.
So, the bit should be high from RunFirst until RunLast runs.
Unfortunately it doesn't.
 
Code in RunFirst:
[203128%2F9262735%2Fmceclip0]
 
 
Code in RunLast:
[203128%2F9262737%2Fmceclip0]
 
Notice that Voltage remains 0
I've reduced the number of tasks to 2 (RunFirst and RunLast). So this is all the code that is running.
Note that this is the "Intances" list, NOT the "tasks" list.
Reply 0 0
kortenbach
Oke, this just got weirder.
I disabled the RunLast POU, so now only RunFirst is running:
[203128%2F9262735%2Fmceclip0]
 
If I run the simulator and manually force "FirstCycle" high, then voltage is set to 230 (as expected)
If I manually force "FirstCycle" low, "Voltage" changes to 0 again???
Reply 0 0
kortenbach
Found it.
It's the debugger that was fooling me into thinking that Voltage actually changed back to 0.
Fact is, it didn't.
I think that, because MOVE was not executed the Voltage value was monitored incorrectly.
 
Doing this helps:
[203128%2F9262823%2Fmceclip0]
Reply 0 0
thiagoralves
Yes, the debugger defaults all outputs to 0 if the block is disabled. But this doesn't mean that the variable connected to the block is actually zero. Since the block is not being executed at all, there is no action or change on the variable. You can see it better by looking at the variable on the debugger (click on glasses next to the variable). You will see on the debugger panel the actual value of the variable.
Reply 0 0
kortenbach
Yeah, that is what I thought. Thanks.
Any news on my post "Compilation suddenly failing"?
Reply 0 0
Reply