RobotStudio event

First cycle flag in Rapid

dragolollo
edited January 2023 in RobotStudio
Hello,

Is there a flag in RAPID that states if it is the first cycle after controller power on?
Thank you!
Tagged:

Comments

  • Did you ever find anything to do with first cycle? I have a few things I need to do in first cycle only too.
  • Try an event routine for Power On to run a one instruction routine that sets a PERS boolean, e.g. bFirstCycleOnly, variable TRUE.

    PROC rPowerON
    !
    bFirstCycleOnly: =TRUE;
    !
    ENDPROC

    Be sure to change state of the PERS to FALSE in your production code.

    As an idea in production code 

    PROC rFirstCycle()
    !
    IF bFirstCycleOnly THEN
    Stuff
    bFirstCycleOnly: =FALSE ;
    ELSE
    Return;
    ENDIF
    !
    ENDPROC