08-08-2006 02:00 PM
08-08-2006 10:02 PM
From what i could understand, you want to use the data that is being generated/read inside a while loop, from outside the loop, even as the while loop is running
For this, try implementing the producer/consumer pattern or master slave patters
Hope this helps
Regards
Dev
08-09-2006 03:13 AM
Hi all,
Well i didn't understand the problem exactly...
As someone talked before about that those structures can be a solution if that is the problem.
If u are making a data acquisition with a single point and u need 2 points... why dont u make 2 point acquisitions????
if you need the actual and previous values use shift registers in the while loop... you can add as many as you want to see previous data.. (just clicking right on the mouse and add element)... se example attached.
Don't know if any of those solutions solves your problem...
If not just say something and try to explain some more (examples, vi's ???) to let us understand better your problem,
Regards,
Jaime Cabrera
NI Applications Engineering Spain
08-09-2006 04:44 AM
devchander
Thanks for the links, will be very useful for me to learn more on labview programation.
Jaime
Thanks for your entry.
You are right. I am using while loop with serial port, so each iteration show one value of sensor. I could expect 2 readings on serial port while loop and use this data. I did that and it works. Right now I am using queues to get the data from while loop to another parallel while loop, in this I show the dials and anothers calculates, here is where I can show the graph using 2 values, which will give 1 sample to show in graph.
With your first advise, I got readings 16 bytes, instead 8. And each iteration of queue in parallel while I got 2 readings to work in it.
I put one capture, you can see the queue with 2 while loops, in this case I read 5 numbers each iteration.
With the second, i would like to see your example, but I can't since it is LV8.0, I am working on LV7.1. CAn you fit to previous version?.
I would like to use this case, so I could remember the last value and use to get the sample. But i Didnt get it. I use shift registers, but only show the array one time the while loop has finished. Show me in LV7.1 or any capture if it is possible.
Gracias por tu ayuda, yo también soy de España, concretamente de Cartagena.
08-09-2006 05:14 AM
08-09-2006 05:15 AM
Hai
You can use two clusters ( NewData and OldData). Update the NewData Cluster with your typecasted output.
Use In second loop check the new data perform process and update with OldData Cluster.
You no need to use queue to get data, you can use a local variable or property node to get Cluster data.
So every time you will get a NewData Cluster and an Olddata Cluster to compare.
08-09-2006 06:01 AM
Hi Tom, thanks for your help!
Well Keep in mind, this vi, really is subvi. I have main panel where I push bottom, then appear this window to acquire the data.
When I push start, begin the acquire data. In this case 8 bytes. 3 of 2 bytes and 2 1byte.
In this window i show the rpm and km/h reading from sensors. I used queues to get in real time each value and not slow the main while loop. The stop is so, since I stop the acquisition on 2 ways. First is pushing cancel, then the acquisition stop and all the data pass to `array' other way is when I push external bottom to stop the pic to sends, then the vi show the error in time outs in serial vi and therefore stop spent this time. After array is feed and this subvi is connect in main vi, which gets the full data, do calculates and show differents graphs. But on this system I only see the graph when the acquisition is finished. In this case works fine.
Now, I would like improve a little and show the graph drawing in real time. That's why I can get 2 values and get 1 sample. But I can't use the external array of dequeue. I am trying get the old value and put another subvi inside and draw the graph.
I dont understand your last advise.
I would like to hear any posibility.
08-09-2006 06:04 AM
Hi Soundar,
It seems interesting. But i dont get very clear.
Can you show me any example??. Or any way to do it?.
Thanks.
08-09-2006 06:24 AM
I added simplified vi.
08-09-2006 11:39 AM
I have one problem trying to get it.
When i send the sample to draw in graph, I only got draw one point and later it it disappears. Any way the maintain all the points or better to connect all the samples in a curve???.
I attached one example to fit.
Thanks.