plclearner123
Member
Hi,
I am working on a ST code aiming to implement timer functionality inside a function block. I am facing the following problems:
-During the execution, in the Main program a function block(FB) is called and inside the FB another function block (TMR) is called. The timer (TON) is defined inside TMR.
-I observed that when TMR is called from FB,even though the TON.IN is set to true and the PT value is passed, the timer does not start counting(for the required preset time).
The same TMR when called in the Main program yields the required results.
-To better understand the reason behind this, I defined a count variable when the main function calls the timer and when the FB calls the timer.
-While in the case of FB call the count variable stops at 1, in the case of Main program call the count variable keeps incrementing.
NOTE:
The FB is called in the main program based on an IF condition.
I have attached screen shots of the call made from FB and main program, the definition of TMR and the debugging operation.
I am working on a ST code aiming to implement timer functionality inside a function block. I am facing the following problems:
-During the execution, in the Main program a function block(FB) is called and inside the FB another function block (TMR) is called. The timer (TON) is defined inside TMR.
-I observed that when TMR is called from FB,even though the TON.IN is set to true and the PT value is passed, the timer does not start counting(for the required preset time).
The same TMR when called in the Main program yields the required results.
-To better understand the reason behind this, I defined a count variable when the main function calls the timer and when the FB calls the timer.
-While in the case of FB call the count variable stops at 1, in the case of Main program call the count variable keeps incrementing.
NOTE:
The FB is called in the main program based on an IF condition.
I have attached screen shots of the call made from FB and main program, the definition of TMR and the debugging operation.