Roze

CP1L and timers in ST

6 posts in this topic

Hello,

I'd like some help with using timers in structured text, how to make block independent timers like in Ladder function blocks in ST?

like  IF condition THEN enabledTimerVar; END_IF; IF timerFired THEN doStuff; END_IF;

CX-Programmer says I cant use the TIMER datatype.

//Kind Regards.

Share this post


Link to post
Share on other sites

Thank you.

After some searching I managed to make a workaround. The TIMERS.zip file referenced in the linked thread is not available to me, so had to figure out how to do it myself. :)

//Kind regards

Share this post


Link to post
Share on other sites

So how about showing us all how you did it?

Sharing feedback on posts is one way of showing gratitude and helping other MRPLC members who may have similar problems.

:kewl:

Share this post


Link to post
Share on other sites

I'll post it when back to work, whenever that happens, I seem to have gotten sick.

Share this post


Link to post
Share on other sites

As promised, here is the solution:

5c7e46be8e908_Skrmklipp.thumb.PNG.891ab6

Input Variables:

5c7e47a1f3034_Skrmklipp2.PNG.a01d48e7299

Output Variables:

5c7e47a3c6131_Skrmklipp3.PNG.010ad0589aa

And to call that from ST when programming for a CP1L CPU :

Create a variable with a function block reference of the Timer Ladder Function Block.

timerVariable(EN:= EN, TON:= condition, TimerValue:= number_or_variable, Out=>boolOutFlag);

 

//Regards

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now