06-07-2008 10:42 AM
06-07-2008 11:35 AM - edited 06-07-2008 11:36 AM
Use a queue.
When you have multiple writers and one reader, is usually better to use a queue. So you can not lose data.
Put the main_vi.png to the main vi. This is not polling. It is more a kind of interrupt. The error case will stop your code if you distroy the queue.
I have placed a enum, but you can use string as well.
06-08-2008 03:45 AM
06-08-2008 08:36 PM - edited 06-08-2008 08:45 PM
Hi turbot,
Here's one way to "close the loop" in a producer-consumer architecture. I haven't tested this particular VI, but have used this technique many times.
Essentially, each producer sends the "command-handler" a unique Notifier that the command-handler uses to return a command-specific response to.
Cheers!
06-08-2008 08:59 PM
Hi tbd, May you give a brief intro of how it works, thanks.
06-08-2008 10:08 PM
06-08-2008 10:41 PM - edited 06-08-2008 10:43 PM
Hi turbot,
The attached VI shows three loops producing "simple messages" and one loop processing those messages. Like PNT said, I used a queue to send the simple messages to the message-handler loop. You said the "Main VI" (the message handler) must reply to a component that sends a message - and asked how to implement it. Here's one way - when a component sends a message, it also sends a Notifier. When the message handler receives a message, it uses the Notifier to send a response to the component!
Cheers.
06-09-2008 02:54 AM
06-09-2008 02:54 AM
06-09-2008 03:07 AM
Hi turbot,
it is a buffer which stores the reference. It first checks if the shift register contains a valid reference. If it is false, a new notifier will be created and the reference will be stored in the shift register, if it is false the old valid reference will be used, without creating a new notifier.
Mike