ofer.yishai Posted June 9, 2017 Report Share Posted June 9, 2017 Hi all! I would like to place a local timer in a UDFB, but this option is not available (The timer save key is disable when it is set to local) I guess there is a reason why local timer is not possible... The option I know is to define the timer as a Function-In , but then i have to connect a different global timer on each of the UDFB instances, and in case there are many of them we miss the concept of UDFB somehow. So I was trying another option to count seconds on a Local Counter (Inc function to Local INT16 Tag) . The counter pulse come from a Function-In Bit (One scan every 1 second). The problem with is the counter is not increasing if the tag is local, and it dose very well if the tag is global. This I can see with the latest Unilogic version that support monitoring UDFB online, very helpful! Any help regarding timing and counting within UDFB local tags is welcome. Ofer Quote Link to comment Share on other sites More sharing options...
Saragani Posted June 10, 2017 Report Share Posted June 10, 2017 You can't use a local timer, since local tag means that it is being created on the stack when you enter the function, and deleted when you exit the function. This means that it will not count. The same thing happens with a local int16. Everytime you enter the function, a new int16 is being defined on the stack with a value of 0. 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.