LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Keeping data on graph once while loop exits

Hi, I have the attached vi where I am reading in Bluetooth data, plotting and saving the data. My inner while loop is the one performing the plotting, where I have the error out of the Bluetooth Read function wired to the boolean control of the loop. If for some reason the connection gets distrupted, the loop exits and the BT automatically reconnects.  The problem here is that one the inner loop stops, the graph plotting the data clears.  I am looking for a way to keep the data plotted on the graph, so once the connection is lost and reconneted again, the data continues plotting from where the connection was lost.  I cannot figure out how to do this, I tried to use local variables to plot the data outside the graph while the loop is running but that didn't work. Can somene provide me assistance?

0 Kudos
Message 1 of 12
(3,409 Views)

I included a small check, and I think it should work now...!!

 

Modification.png


I am not allergic to Kudos, in fact I love Kudos.

 Make your LabVIEW experience more CONVENIENT.


0 Kudos
Message 2 of 12
(3,400 Views)

Hi, thank you, and sorry for the messy code :), I usually don't clean it up until the program is written. I am referring to the graph which is highlighted in yellow however (attached).  It clears once the connection is lost, i.e. inner while loop stops.  I need to keep this data on the screen always.

0 Kudos
Message 3 of 12
(3,381 Views)

why 2 while loops?   Smiley Embarassed

0 Kudos
Message 4 of 12
(3,372 Views)

This seems eerily familiar...http://forums.ni.com/t5/LabVIEW/Couple-of-questions-regarding-displaying-and-saving-data/td-p/242817...

 

If I remember correctly, you have this loop duplicated to talk to another Blue Tooth device.  What you really need to do is set up a Queued Message Handler.  You have one main loop accepting commands from the user.  Commands would be to start acquisition, stop acquisition, close program.  There might be more, but that would be the obvious ones.  There can be different buttons for each device.  You can then send commands to your other loops via queues or notifiers.  This would also add the benefit of not having a loop that runs forever and being forced to use the Abort button in the toolbar.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 5 of 12
(3,362 Views)

My bad...!!

I was working late night and misinterpretate "Write to File" express VI with "Build XY Graphexpress VI..!!

 

Anyways the attached code should work fine.


I am not allergic to Kudos, in fact I love Kudos.

 Make your LabVIEW experience more CONVENIENT.


Message 6 of 12
(3,340 Views)

Hi thank you, this is what I am looking for. As it stands, when the inner while loop is stopped, i.e. no incomming data, the graph is still plotting zeros vs time due to the outer while loop running.  I am looking for a way to not plot these zeros and the real time while the inner loop is stopped. I can not plot the zeros by sending sqrt of -1 (NaN) to the graph if the data is equal to zero, but the x-axis (time) is still plotting real time.  How do I hault the time axis plotting?

 

I cannot remove the outer loop because of crossrulz reference to my previous post on multiple bluetooth connections, each one needs to be in its own loop for them to work all at once, I have already tested this. 

0 Kudos
Message 7 of 12
(3,325 Views)

@moderator1983 wrote:

My bad...!!

I was working late night and misinterpretate "Write to File" express VI with "Build XY Graphexpress VI..!!

 

Anyways the attached code should work fine.


Here, I took care of some of your Rube Goldbergs.

 

I'll try to get something written up to show a Queued Message Handler...


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 8 of 12
(3,314 Views)

Ok, it is actually a form of the Master/Slave, but the concepts are basically the same.  You have a different loop for each device you have to connect to.  Each loop gets its own notifier.  You have another loop with an event structure to be able to control who is running when.  Also notice that there is a stop button.  You use that to stop your program instead of using the Abort VI button.  It is best to clean up instead of just aborting.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 9 of 12
(3,301 Views)

Thanks for this crossrulz.  I cannot open your code as I am running 2010, 10.0.1.  Can you resend so I can open it?

0 Kudos
Message 10 of 12
(3,298 Views)