I should want to do specific actions in the first cycle the submit interpreter is started (after stopping, or after power on robot).
How can I check this first cycle? Are there specific variables indicating this?
System is KRC2 KSS5.6
First cycle after (re)start of sps.sub
-
Plc_User -
March 18, 2016 at 9:58 AM -
Thread is marked as Resolved.
-
-
Maybe it is possible to put a Bool in sps INIT and have an IF statement in the SPS Loop.
then at the end of this If function put the Bool to falseKind regards,
NoMad -
Put your code before loop. .. this will ensure it is executed once only. ..
-
One caveat there -- it will be executed once on boot, or once when the SPS is De-selected and then re-selected. But if the SPS is just stopped, this code won't execute -- a stop of the SPS merely pauses the program pointer. The only way to get the pointer back to the top of the SPS, above the LOOP statement, is to de-select and re-select (or cold boot).
-
You may also start and reset a timer at each SPS cycle and check if the value of the timer exceeds a fixed value, for example 500ms.
This will detect if the SPS has been stopped for more than 500ms.diglo