LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Otherwise functional datalogging program locks up when GPS subvi is added

Hello folks; I'm leaving on a testing trip this weekend and my program doesn't work, so any suggestions are welcome.

My program ("MEDUSA fuel monitoring.vi") lets the user select CAN channels to watch from a NI-CAN database file. The While loop then starts and displays data from the CAN bus as well as a temperature from a 3rd party device ("TIn.vi"). The user can then flip a switch and write data to a spreadsheet file each loop. That all worked fine and good by itself (although I'm sure I should be managing resources better with the open spreadsheet file).

 

Next I had to add GPS information to my data file. I am using a standard NMEA 0183 receiver that is bringing in data through the serial port. Since reading the COM port and parsing the serial strings is beyond my current LabVIEW skills, I poked around NI.com until I found ReadGPSTimePositionVelocity.llb. I poached Read NMEA GPS SubVI.vi from there and inserted it into my main While loop after confirming that the GPS program worked splendidly by itself.

 

The program now locks up as soon as I enter the While loop (after user presses <GO> in the SETUP tab). If I highlight execution and watch the block diagram I can see that the GPS subvi is running and nothing else. None of my stop buttons work and I have to close the program to stop. The GPS subvi is one big While loop. This may seem like a dumb question, but can I have a While within a While?

 

Thanks in advance - there's a 6-pack of Sam Adams in it for my savior!

0 Kudos
Message 1 of 2
(2,417 Views)
You don't have an understanding of how dataflow works. When you call the subVI, you pass control to it. You don't have control of the main until the subVI finishes and you have no way to stop the while loop in the subVI because the front panel of the subVI is not visible. Wiring a Boolean control to the subVI does nothing. Get rid of the outer while loop in the subVI. That way, each time it is called, it will take a single reading and return it. You should also move the com port initialization and the VISA Close to the top level. There is no point in doing either each time the subVI is called.
0 Kudos
Message 2 of 2
(2,416 Views)