LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

event structures and poling at the same time

Hello,

 

I am writing a Vi which gets some data from a serial port analyses it then displays it. I am using a state machine to achieve this, so it poles for any data on the serial port in a "Wait for data" state

 

I have two dials on my front panel, and when they change value I'd like to jump to particular state. 

 

I wanted to use an event structure for this, but it doesn't seem to behave as I'd hoped (like an interupt on a microcontroller or an event in C#) it waits at the beginning until one of the events occurs then continues.

 

 Will I need to re-do how I detect data from my serial port and buttons on the front panel?

 

And  

Is it possible the event structure to check for data on a serial port?

 

I attached a screenshot to give you an idea what I am doing.

0 Kudos
Message 1 of 3
(2,985 Views)

You could use a producer/consumer event based for the UI control. The consumer should be extended to a queued statemachine working with the serial port.

Another option would be a second (polling) producer which enqueues to the same queue in order to supply data to the consumer. The consumer would have to evaluate and react on the data/commands which are generated by both producer.

 

hope this helps,

Norbert 

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
Message 2 of 3
(2,970 Views)

You can create an user event and fire that when from the polling cycle, then handle the data inside the event structure.

 

Felix 

0 Kudos
Message 3 of 3
(2,949 Views)