12-10-2009 02:07 PM
I have a problem in one of my application when I use case structure in event structure.
In my event structure, I have
[0] Time out
[1]<my user event>: User event
[2]"setpoint": value change
[3]"stop": value change
The event structure will run [0] Time out when no action is happened. the event structure will switch to [2]"setpoint": value change when I enter the value.
I set one case structure in event structure to execute the code of case (1) when the value change.
The problem is case structure is not switch to case (1) when I enter the value. I guess when I enter the value and hit the ENTER key, the event structure is still at [0] Time out. So when the event structure switch to [2]"setpoint":value change, the action of "enter the value and hit the ENTER key" is done. Therefore, the case is considered as case (0).
I used the highlight execution mode to track the action of VI, and that's my guess. I do not know it is true or not?
Any thought?
Thanks,
PS: here is the example to explain my case
12-10-2009 02:25 PM
12-10-2009 02:47 PM
12-10-2009 03:46 PM
Hi CP_AT,
1) In the example you posted, the event case has not been configured. If it was configured, you would see something like:
[1] "Numeric 3"; Value Change
at the top of the structure.
2) If there is no value connected to the Timeout Terminal you will not execute the Timeout Event (by default the setting is "-1" = never timeout).
3) Keep in mind, that nothing executes in an event structure unless an event that has been configured occurs.
4) As Dennis said, case structures can't deal with doubles (only integers) so the value of Numeric 3 will be coerced into an integer (see the red coercion dot). This can cause unexpected behavior.
Maybe the code fragment you posted is not the real code, because what you posted looks like it would not run (i.e. errors would cause a broken arrow).
steve
12-10-2009 04:33 PM
Hi Dennis,
The integer does not make different. It is always go to case 0
Hi Steve,
Yes, the example does not work because I just try to do quick to explain my case.
12-10-2009 04:40 PM
12-10-2009 04:55 PM
I found one thing: It only go to case 1 if I enter number 1. If I enter anynumber but 1, it will go to case 0. That's not what I want because my application is control the temperature, so I want anytime I change the temperature it will go to case 1 to execute my code.
Any suggestion?
12-10-2009 05:11 PM
Yuppie! I found the way to make it work.
Thank you very much, Guys! Your suggestion are very high appreciate. It helped me to think all the way through how to solve the problem.