0
Answered
Internal variable false but result true
Rich Saunders 10 months ago
in IQANdesign
•
updated by Gustav Widén (System support) 9 months ago •
6
My internal variable is false but my result is true and it is not a latching function?
Customer support service by UserEcho
I think it is best to also set the false.
so, then EmStop := true else Emstop := false
The value of non-static variables are undefined between cycles. In this case it retained its value, but that may not always be the case.
As Ed suggest, it should be set before use in each cycle.
I tried that and still did not return to false, changing the IDC from Q code to object list solved it. I have also had another case with a piece of software recently updated to design 6, trying the suggested did not help.
This is working via the simulator, if you start to measure with the non static variables as false then the result will be false, once you enable the output it seems to latch on and not return to false even if all the variables return to false.
In your code, the variables are only assigned the value true; to build it up like this you also need to set to false.
You could achieve this with an else statement for each variables.
A more compact way of always assign the variables would be something like this
Alternatively, you could avoid the named variables and assign your result directly, like this
As yet another option, you could use a classic object list instead
Thank You Gustav
The code as posted worked OK on the Design 5 projects, I guess I need to tidy this up going forward, for some reason I put the code as an IF statement in this instance.