05-07-2009 06:03 AM
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.
05-07-2009 06:25 AM
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
05-07-2009 07:32 AM
You can create an user event and fire that when from the polling cycle, then handle the data inside the event structure.
Felix