LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to make a multi to one notifier

There are serveral program components (vis) need to talk to one main vi. They all in same pc.
When the main vi receive the simple message they send out, will check and make a simply reply.
 
Can I do it with notifier? If server component send simple message to main vi at same time, will it be lost?
This kind of message will not send frequently, so I may not want to use poll a queue. I am not sure if it is right.
 
0 Kudos
Message 1 of 27
(3,777 Views)

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.



Message Edited by Pnt on 06-07-2008 07:36 PM
0 Kudos
Message 2 of 27
(3,771 Views)
The main vi also needs to reply to the component vis. May I know how to implement it.
0 Kudos
Message 3 of 27
(3,750 Views)

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!



Message Edited by tbd on 06-08-2008 08:39 PM

Message Edited by tbd on 06-08-2008 08:45 PM
"Inside every large program is a small program struggling to get out." (attributed to Tony Hoare)
Download All
Message 4 of 27
(3,729 Views)

Hi tbd, May you give a brief intro of how it works, thanks.

0 Kudos
Message 5 of 27
(3,721 Views)
Hi Pnt, the components message also includes some information. Then how to implement it. Thanks.
0 Kudos
Message 6 of 27
(3,710 Views)

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.



Message Edited by tbd on 06-08-2008 10:43 PM
"Inside every large program is a small program struggling to get out." (attributed to Tony Hoare)
Message 7 of 27
(3,703 Views)
May I know how does the crcled loop in the attachment work? Thanks
0 Kudos
Message 8 of 27
(3,676 Views)
May I know how does the crcled loop in the attachment work? Thanks
0 Kudos
Message 9 of 27
(3,674 Views)

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

0 Kudos
Message 10 of 27
(3,671 Views)