How to use Start_ code block in AC800M ?and how to find it?
I need to detect first start cycle of application,e.g. Enable logic just in one Cycle after warm restart,
I checked "FirstScanAfterApplicationStart" function, but it acts after Download the changed Application,
the Start_ code block is other way mentioned in on of posts,as below:
but i cannot find it in AC800m CBM, Where is it?
Thanks for Help
Voted best answer
You just make a code block and call it "Start_Something"
Note that this ONLY works in Control Modules - NOT POU Programs. In this case you can use "FirstScanAfterApplicationStart" or "FirstScanAfterWarmStart"
or you can just code code a very simple workaround ...
Define "FirstScan" as Local Variable, type = Bool, Retain = Blank (ie not retained), Initial Value = TRUE
IF FirstScan THEN
// Your Initialization Code Goes Here
Every time the controller is downloaded (warmstarted) "FirstScan" will be set to "TRUE" ( This initital value is not retained ) Your Initialization Code will then execute once only.
You can adapt the same trick for Cold Restarts by setting FirstScan to "Retain" ( ie a Cold Start will reset the variable )