What is the simplest way to have a delay in the code of a CALC block? I need to execute a command and wat xx seconds before the next line is executed.
A calc block cannot wait in the middle of its code.. The code will have to finish, but set a counter variable that increments with each scan. Put in an if counter greater or equal to x line that executes the new code. Make sure to initialize and reset the counter appropriately.. if the module or controller is over taxed, a scan rate count may not equal a consistent time value however. I can send an example if you need clarification. jwooten84 <bounce-jwooten84@community.emerson.com> wrote:
In reply to Youssef.El-Bahtimy:
I knew I could do with an additional timers and such, but just wanted to verify that I wasnt missing something in the syntax to delay. I even tried with a WHILE loop and no success. Thanks for the assistance though. Calc is using a timer built into the module for the delay.
Andre Dicaire
In reply to Andre Dicaire:
One problem with counting scans is that sooner later, someone is going to change the scan time of the module and the code will not work the same way but they might not see why because the CALC block might be buried somewhere down in the module. A CND block has a timer built in and, depending on what you are trying to do, several CND blocks might be able to handle the logic. Alternatively, you can tie a CND block and a CALC block to do pretty much anything that requires a single timer.