Retain ACT1 value in (ONB_IO_CNT) FB in AC500-eco
Is it possible to retain the ACT1 value of fast counter funtional block ONB_IO_CNT in AC500 PM55x PLC after power cycle.? I tried by declaring that ACT variable as retain and global but it is not working. Any help is appreciated.
Voted best answer
It is not possible to use directly the output ACT1 as retain. Of coures, you can use transfer of ACT1 to other retain persistent word, but during the first cycle the ACT1 is always reset to 0, so at first cycle you will receive 0 again to the retain word.
I managed to do that, it is not very easy. Use the FB TASK_INFO - it counts the number of executed cycles and shows zero 0 at it's output when the first cycle is executed.
So I jump (not execute) the writing from ACT1 to the retain word during the first cycle.
Also you will need to set the ONB_IO_CNT to the last "remembered" value during the first cycle in order to continue counting from that value.