LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Getting the previous notifier message

Solved!
Go to solution

Hi All,

I've been having issues with a state machine, which due to numerous complications and hassles, has now become a master/slave setup.  I'm using notifications to communicate between a master loop (which relies upon hardware digital inputs to detect state changes), and the various slave loops.  The only message in the notification is the current state.

 

I have some logic which would ideally like to see what the previous state was, so I can detect when a state changes and trigger things to happen at certain state transitions, so being able to see what the previous notification was would be very helpful.  I can't seem to figure this out though, as none of the usual tactics like shift registers or feedback loops seem to work with notifiers.  Is there a method to do this?  I figure that I'm missing something simple.

 

Cheers,

Kevin

0 Kudos
Message 1 of 5
(587 Views)

Hi Vartley,

 


@Vartley wrote:

I have some logic which would ideally like to see what the previous state was, so I can detect when a state changes and trigger things to happen at certain state transitions, so being able to see what the previous notification was would be very helpful.  I can't seem to figure this out though, as none of the usual tactics like shift registers or feedback loops seem to work with notifiers.  Is there a method to do this?  I figure that I'm missing something simple.


Use a shift register to store the value of the last notification - don't store the notifier reference in the shift register! (That's what I guess from your text.)

 

When you have problems with your code it most often helps to find them when you would attach that code to your message…

 

WaitOnNotification also has two options which might help in your case: "Ignore previous?" and TimeOut (with "timed out?" output)!

Why do you use notifications and no queues for your master/slave approach?

Best regards,
GerdW


using LV2016/2019/2020 on Win8.1/10+cRIO
0 Kudos
Message 2 of 5
(580 Views)

Hi GerdW,

Sorry, completely forgot the vi.

 

This is how I attempted to do things, but yeah, didn't work.  

 

I went with notification instead of queues due to the need to have one loop controlling state, and multiple other loops reacting to the state.  Queues look unsuited to that task (but I am a newbie so i might be missing something there).  

 

I also played with keeping the shift register uninitialised and putting the control inside the loop, but notifiers just don't seem to work the same way that other data does.

 

As for shift registering the value, that doesn't work for me either, as the state is controlled in another loop that  hang on, I think I know what you mean.  I'll give that a go.

Vartley_0-1600850801271.png

 

 

0 Kudos
Message 3 of 5
(571 Views)
Solution
Accepted by topic author Vartley

Hi Vartley,

 

as I wrote before:

DON'T put the notifier reference into the shift registers! Put the notifier data into shift register(s)!

 

When editing your VI this should (or: could) be the result:

Best regards,
GerdW


using LV2016/2019/2020 on Win8.1/10+cRIO
Message 4 of 5
(567 Views)

Thanks for this GerdW.  i got so hung up on trying to get the previous notifier, that I didn't realise that the next step involved me extracting the data from the notifier anyway.  Greatly simplified.

 

Thanks again,

Kevin

0 Kudos
Message 5 of 5
(558 Views)