Program to only be run after PLC start

Hello,
Is there a way to have a program run only after the PLC has been rebooted? And this program will only be executed after the next boot of the PLC? If so, how can this be done?

Kind regards,
Alexander

Hi alexandervb,
I suppose you can use an event task of type Warmstart for that. It is executed once when the PLC performs a warm start (it does on reboot).
In addition to that you can use retain variables to control when and if code is executed:

RetainCounter := RetainCounter + 1;
//executed once after the next reboot
if RetainCounter = 1 THEN
//do stuff
END_IF

Cheers
DivisionByZero