LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

case structure in event structure

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

 

 

untitled.GIF

 

 

0 Kudos
Message 1 of 8
(3,198 Views)
To help I would have to see more of your code to understand what you are doing. What you show does not help.
Tim
GHSP
0 Kudos
Message 2 of 8
(3,185 Views)
A problem is that you have a DBL wired to the case selector. You should never do this because a computer cannot perfectly represent a floating point number. Convert to an integer and see it that makes a difference.
0 Kudos
Message 3 of 8
(3,170 Views)

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

 

 

 

 

----------------------------------------------------------------------------------------------------------------
Founding (and only) member of AUITA - the Anti UI Thread Association.
----------------------------------------------------------------------------------------------------------------
0 Kudos
Message 4 of 8
(3,152 Views)

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.  

0 Kudos
Message 5 of 8
(3,134 Views)
Maybe you could use an enumerator instead of an integer/double?
Harold Timmis
htimmis@fit.edu
Orlando,Fl
*Kudos always welcome:)
0 Kudos
Message 6 of 8
(3,129 Views)

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?

 

 

0 Kudos
Message 7 of 8
(3,122 Views)

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.

 

 

0 Kudos
Message 8 of 8
(3,114 Views)