Skip to content

Timers in C# library

I need to use some Timer functionality in my C# library.  C# Timers are not supported in the PLCnext C# framework. Threading also has Timer, but this is also not supported.  As a final resort, I am trying to use TimeSpan.  This is supported, but does not seem to work. No matter how I initialize or set my TimeSpan, it is always "null".

I have a Function Block with an 

        [Input, DataType("TIME")]
        public uint tPT;

 

Setting this to T#20s in PLCnext Engineer is successful and I can see that tPT is equal to 20,000 in C# debugger.  Now I create

public TimeSpan Preset = TimeSpan.FromMilliseconds(tPT);

 

The debugger shows Preset ="null".  Is there some magic I am missing?

Comments

Sign In or Register to comment.