On PCWorx, I am able to access two system variables PLC_TICKS_PER_SEC and PLC_SYS_TICK_CNT. How can I get access to these two variables on the plcnext?
Hello Gian,
the simplest way is to create a cyclic task with e.g. 1 ms cycle time and increase a variable in each cycle. This variable is unfortunately not as precise as the PC Worx variable but this is as close as you can get in PLCnext Engineer.
The second option is to create a fast trigger signal via timers and increase the counter with a rising edge of that signal. With the TON_LTIME FBs, times below 1ms can be specified (see attached image).
There is also an Environment.TickCount Property listed in the eCLR Programming Reference, that represents "the amount of time in milliseconds that has passed since the last time the computer was started."
Comments
Have a look at this post: https://www.plcnext-community.net/en/discussions-2-offcanvas/tick-count-not-incrementing.html#reply-2531
the simplest way is to create a cyclic task with e.g. 1 ms cycle time and increase a variable in each cycle. This variable is unfortunately not as precise as the PC Worx variable but this is as close as you can get in PLCnext Engineer.
The second option is to create a fast trigger signal via timers and increase the counter with a rising edge of that signal. With the TON_LTIME FBs, times below 1ms can be specified (see attached image).