# First cycle flag in Rapid

**URL:** <https://tech-community.robotics.abb.com/t/first-cycle-flag-in-rapid/11010>\
**Category:** RobotStudio\
**Tags:** first-cycle, flag\
**Created:** [January 30, 2023, 8:20am UTC](https://tech-community.robotics.abb.com/t/first-cycle-flag-in-rapid/11010 "2023-01-30T08:20:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dragolollo](https://avatars.discourse-cdn.com/v4/letter/d/f9ae1b/32.png) [@dragolollo](https://tech-community.robotics.abb.com/u/dragolollo)\
**Post date:** [January 30, 2023, 8:20am UTC](https://tech-community.robotics.abb.com/t/first-cycle-flag-in-rapid/11010/1 "2023-01-30T08:20:11Z")

</div>

Hello,

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

---

<div class="post-metadata">

**Author:** ![leem2209](https://avatars.discourse-cdn.com/v4/letter/l/97f17d/32.png) [@leem2209](https://tech-community.robotics.abb.com/u/leem2209)\
**Post date:** [November 1, 2024, 2:29pm UTC](https://tech-community.robotics.abb.com/t/first-cycle-flag-in-rapid/11010/2 "2024-11-01T14:29:02Z")

</div>

Did you ever find anything to do with first cycle? I have a few things I need to do in first cycle only too.

---

<div class="post-metadata">

**Author:** ![SomeTekk](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/sometekk/32/151_2.png) [@SomeTekk](https://tech-community.robotics.abb.com/u/SomeTekk)\
**Post date:** [November 22, 2024, 9:55am UTC](https://tech-community.robotics.abb.com/t/first-cycle-flag-in-rapid/11010/3 "2024-11-22T09:55:41Z")

</div>

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
