LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Register for Events Generated in a Subvi

Hi Everyone,

 

I am a relatively new labview programmer, so please bear with me if any of my questions are simple.

 

Basically I have a project which has multiple different IO sources with an overall top level control and display program.

 

To start with, I am writing a driver for a GPS device. The GPS driver reads in strings from the COM port, and then passes them to the GPSParserBuffer, which converts each of the possible strings and puts it into a cluster.

 

What i would then like is for an event to be generated whenever a new string comes in.

 

This event will then be passed to a GPS display VI, which will listen to the events, and display only a portion of the information to the User.

 

at present, the driver and buffer work correctly - i can run my code and the GPS cluster fills correctly.

 

What I am struggling with is passing this event to the GPS Display vi. The generated event never seems to make it out of the parserbuffer, and hence the GPS display never gets triggered.

 

I have adapted this from another GPS driver i have seen which works in this way, but i cant seem to get mine to work.

 

Thanks in advance

Ben

 

Top Level tester VI - GPS.vi runs and fills GPS cluster

GPSTest.JPG

 

GPS.vi initialise case

GPS_Init.JPG

 

GPS.vi read case. Probe "28" and "30" contain the event number, but Probe "32" does NOT - i suspect this is my problem but im not sure what the issue is.

 

GPS_read.JPG

 

GPSparserbuffer.vi - initialise case where the event gets generated

 

 

Parser_Init.JPG

parserbuffer run case - an event is generated every time the GPS cluster is updated

Parser_Run.JPG

 

GPS Display code - register for a data event and put select values from GPS cluster into the GPS Monitor indicator.

Display.JPG

 

0 Kudos
Message 1 of 6
(3,536 Views)

If I want to generate event from sub VI what I do is...

1) Create value change event case associate with any boolean(Say trigger).

2) Pass boolean reference to subVI.

3) Generate event using value signaling property node.

4) In your case you can check for new string and generate event using value signaling property node.

 Check attached VI

 

PBP
Labview 6.1 - 2019
Download All
0 Kudos
Message 2 of 6
(3,511 Views)

Thanks, ill give that a try and get back to you.

0 Kudos
Message 3 of 6
(3,497 Views)

thinking about it more, this will suit my needs very well - I could also modify the code so that I can include update rates on certain controls too - for instance, someone might set the GPS to send 10 messages per second, which for my application might be too much, so I could also set it to just update the front panel once every two seconds if I need, AND also keep the timeout case in the event structure for data dropouts.

 

once I finish changing the code I will repost some screen captures.

0 Kudos
Message 4 of 6
(3,490 Views)

Good check and let  me know.

Give KUDOS or marked as solution to post if it has solved your problem. 🙂

 

PBP
Labview 6.1 - 2019
0 Kudos
Message 5 of 6
(3,475 Views)

I ended up sticking with the User event generation - the actual issue was that I had a global functional variable (GPS.vi) that didn't exit on the read case, and so it would get stuck in there and therefore not pass the event generation (or the other data) up to the top level vi to be actioned.

 

Thanks for your help

Message 6 of 6
(3,387 Views)