SolarBear Posted May 31, 2005 Report Share Posted May 31, 2005 Hi ! First time posting here. Please pardon my relative newbieness to LabVIEW : I've received little training before beginning this project. I'll try to explain my problem as clearly as possible. I've isolated all analog port reading-related code in a sub-VI, which stores the read data in an array, which is returned when the reading time is over. The problem is that it will fill my waveform chart only after the sub-VI finished executing, which means that instead of seeing my data in real-time, I get all of it in one shot. Whic is precisely what I do NOT want, heh. So, how could I get my data from my sub-VI to return my data "one by one" instead of all in one big blob ? Hope I was clear enough. Thanks for your help. Quote Link to comment
Mark Balla Posted June 1, 2005 Report Share Posted June 1, 2005 First make sure that that you are using Waveform Charts not Graphs. Graphs will only accept arrays or special clusters. Try this code to pull the data out of the subvi. Download File:post-584-1117597826.llb I would only do this if the subvi acquiring the data is slow >200 ms per reading. The reference method is useful for this type of application but it is not recommended for acquiring data fast. Quote Link to comment
Louis Manfredi Posted June 1, 2005 Report Share Posted June 1, 2005 Hi SolarBear: The key point is that a Sub-Vi doesn't, through its output terminals, return anything until it completes execution. In the same way that the FOR loop in the example Mballa posted doesn't provide any data to the outside until after it completes all 20 iterations. There are a bunch of ways around this problem. The simplest, perhaps, is to have your sub-vi that collects data collect only one sample, and add it to the display one sample at a time (like data is put into Mballa's "Wave Chart During" indicator.) That is not as efficient, and timing might not be as accurate, as collecting data many samples at the time, but if your sample rate is slow, it is the most straightforward approach. If life needs to be more complicated, you might collect a few samples each time you call the sub-vi, and add them to the display, or post the data to a Queue, and read it in a separate display loop as it becomes available, or a variety of other more complicated tricks. NI has nice example vi's for most of their hardware, your best approach might be to check those out, and start with one that you can modify to fit your needs. :thumbup: Good luck & best Regards, Louis Quote Link to comment
regisphilbin Posted June 1, 2005 Report Share Posted June 1, 2005 Would it be possible to use the VI server method inside the sub-vi to "update" data to the main Vi's waveform chart? Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.