- HMI Model: cMT2166X
- EasyBuilder Pro Version: V6.10.01.323
Hi, is there a way to stop a macro before it has finished. By using the security bits the macro still seems to complete even if its security bit is longer ON anymore. There is a function for triggering a macro so surely there is a way to stop one.
How to stop a macro during its run
none
5.0
1
Hi @MiddupJ,
Thank you for contributing to our forum.
There isn’t a function that stops the macro mid-execution. The way I recommend stopping a macro is to use a return statement. In the example below, I have a for loop running with a check on the bit at LB-100. If that bit is on, then the macro will stop running and restart when the bit is turned off. Otherwise, it will set the value i to LW 100.
Please let me know if you have any other questions!
macro_command main()
bool stopFlag
int i
for i = 0 to 10
GetData(stopFlag, "Local HMI", LB, 100, 1) // read the bit at LB 100
if stopFlag == true then
return // exit macro early
end if
SetData(i, "Local HMI", LW, 100, 1) // Set the value of i to LW 100.
// Simulate a process step
DELAY(50)
next i
end macro_command
Hey Aaron,
Awesome I wasn’t aware of doing it this way,
Many Thanks
Joe
1 Like