Skip to content

PLCNext System Variables

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?

Comments

  • The variables still exist in PLCnext Engineer but are no longer supported. The value is always 0. They are part of the ESM_DATA variable (see image).

    Have a look at this post: https://www.plcnext-community.net/en/discussions-2-offcanvas/tick-count-not-incrementing.html#reply-2531
  • @Stefan Brinkmann# could you please show how to create a tick counter using a timer.
  • 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."
  • As Martin has described it is possible to use the TickCount parameter in C# and output it via a function block (see attached image).
Sign In or Register to comment.