From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

logic AND with event structure

Solved!
Go to solution

hi everyone,

 

The event structure can handle multiple events at a time to do the same thing : looks like a logical OR. But I haven't found a way to sequence events to approach a logic AND. Example: first click on a Draw button and then enter the image would make the mouse cursor change. With an event structure, I can handle these 2 events separetely or together (either one would change the cursor), but i cannot make a sequence of events.

 

Is this possible to do that with an event structure?

 

I hope I am clear (sorry for the english btw). And thanks in advance.

 

Christophe

0 Kudos
Message 1 of 6
(2,469 Views)

Hi Christophe,

you can use shiftregisters to store "old" values. Use events like "enter"/"leave" Control to coordinate the content of them.

 

Mike

0 Kudos
Message 2 of 6
(2,464 Views)
Solution
Accepted by topic author superfunk

I don't think this is possible directly. You will need to add state information to your event loop which would enforce the order of events and the logic rules you desire. In the event processing you would have to check if the required event occurred before this event. If it did, do your processing. If not ignore the event. Your first event would need to set this state information. You may also want to include some type of timeout so that the second event would have to occur within a specific amount of time.

 

This type of logic may be better handled using a producer/consumer architecture and a state machine in the consumer task.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 3 of 6
(2,457 Views)

Mark Yedinak wrote:

 In the event processing you would have to check if the required event occurred before this event. If it did, do your processing. If not ignore the event.


That's exactly what I am trying to do! I am already working with a producer/consumer architecture and with a state machine in the consumer loop. I tried to add state info as you suggested in the event loop. But i do not know if i am doing this well. I attach a very small example where I try to demonstrate what I am trying to do with 2 booleans to be pressed in order.

 

Tell me what you think of the state info in the event loop.

 

 

@Mike : same solution as Mark if I use a shift register and a case structure inside the event loop?

 

Message Edited by superfunk on 03-03-2010 10:24 AM
0 Kudos
Message 4 of 6
(2,438 Views)
I haven't looked at the code and can't at the moment but if you are implementing the producer/consumer architecture I would place the state information in the state machine and not the event structute. It will be easier to do the timing control should you decide to implement it in the state machine. In addition, all of your state data will be contained there and not spread across your architecture.


Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 5 of 6
(2,435 Views)
Ok! I will work on that and get back to you in case of trouble!
0 Kudos
Message 6 of 6
(2,424 Views)