LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Really basic DAQ/graphs/'On demand' question - sorry

This must be a relly basic question and im very sorry but ive been trying to get it to work myself for days. It also seems too basic to be included in any of the help files, manual or forums!
Im working on a project to take data from an inertial measurement unit (6 analogue voltage signals), through a DAQ 6024E and into a PC. Unfortunately i have never used LabView before and so i have had quite a steep learning curve recently!
Basically what i want is to take 6 dc 0v-5v variable inputs from the DAQ card and into LabVIEW, graph each one indivdually and have the data constantly displayed on a scrolling basis. I also want to record the data to an excel file but ive already sorted that part out. Im having problems with the graph.
I would like to produce 6 graphs, one for each channel and show then update on a continuous basis. Kinda like an oscilloscope trace!

What i have done so far:
Working on 1 channel only, open new vi, add DAQ assistant, select analog voltage input, select the first channel (i have a battery and variable resistor on this to replave the IMU), set max and min voltages, select Referenced Singe Ended, continuous sampling mode, clock settings on 100 samples and 1000Hz. Then add a waveform chart and wire it up, fix y axis to 0-5volts, and add a while loop.
When it runs, the graph only updates a couple of times/sec and ive tried to alter the 'number of samples' and the rate but cant seem to get it to be much better. Realistically i only need 50-100 data points recording to the spreadsheet per second but it complains if i try to reduce the rate lower than 1000Hz. Im sure im missing a fundemental point here!
The only way of getting the graph to work ok ish is to change the sampling to n samples but surely i need it to be on continuous for my constant data recording in excel? I think i have more gaps in my knowledge here! Ive also noticed that in the MAX facility, i can set the data acquisition to 'On demand' and this works perfectly! The graph produced there is exactly what i want but i cant replicate it in my VI. Could someone explain the n samples, continuous, on demand, sample rate and number and more importantly how they all link together!

Im sorry to have to post something so long winded and basic but im running out of ideas!

thnaks for reading!!!!!!
0 Kudos
Message 1 of 5
(3,197 Views)
Hi Adlam,

Sorry to hear your having this much trouble.
From how you explain it you should be getting good results. I have run through your description and written a very basic vi using the DAQ Assistant and the Write To Labview Measurement File with the same parameters you posted and I have no problems at all. The chart I use is being updated nice and quickly.
Before delving into the different modes of DAQ I would like to check the hardware that you are using. Could you please post the data acquisition device that you are using, what version of the NI-DAQ software and Labview and finally your PC's spec's.
It looks like there is something fundamentally wrong here. This is the most basic form of Labview programming. You seem to have grasped this no problem but I do not understand why your results are so poor.
I have also included here a very basic vi, how you described yours above. If you could run this and let me know how the chart update performs.
I look forward to your reply,
Matt Poole | Applications Engineer | National Instruments
0 Kudos
Message 2 of 5
(3,167 Views)
Thanks for your very useful information. I have been continuing to try and make it all work and seem to be learning more about the programme even if I haven’t really made that much progress! Im using a DAQ card 6024E into a PCMCIA on a 1.3GHz Pentium with 256Mb RAM running WinXP Pro with s.p.2 and LabView 7.1. The NI–DAQ driver is v1.8.2f0 As for the data source, in the process of fault checking everything, I set up simply a battery and a variable resistor on the analogue input of channel 1 and 0 (one for each) The voltage then simply varies between 0 and 5 volts as I turn the pots.
I have tried your programme and it seems to be practically the same as mine but with a few settings different between then. I tried to run yours first and it didn’t quite work perfectly so I started changing things to see where I can get. Here are the changes I made:
Initially checked that the channel on the DAQ was correct, prevented autoscale on the y axis and changed the values to 0 and +5 (to correspond with my input). At this point, the graph seems fairly stable but still dosent refresh as quick as I would like. It also seems to have a lot of constant noise so I then changed the DAQ settings to RSE and this improved. The graph still seems to update every 0.5 second ish rather than continuous.
Meanwhile, I have also been messing with the settings on my version and I seem to have made it work (and look!!) pretty good. I have attached it for you to have a look at. There are still a couple of questions. I have had to set the acquisition made to n samples with 100samples to read at 1000Hz and this seems to work but I don’t understand why! Will this affect my data in any way? I would have expected it to run better on continuous. I don’t think I understand what the rate and number of samples actually mean! ?
The second thing is that although the graph seems to update fairly well with these settings, it struggles when I am recording at the same time. It seems to jump a little more and also misses out parts of the graph. Could this be processing power on the laptop or something to do with the drivers/hardware etc?

Thanks again for your help.

Andrew
0 Kudos
Message 3 of 5
(3,154 Views)
Hi Adlamb,

It looks like your CPU is being heavily loaded. This is why you have poor updates. The basic code you posted during every iteration of the while loop has to setup the DAQ task, perform the task, read the results then open a new file and write the data, close the file etc, every loop. Usually with todays desktops this is not a problem.
Another thing with the VI is that there is no delay in the loop. This means the while loop is setup to run as fast as it can, it will hog CPU resources. Do you notice that other applications also suffer from very poor performance whilst this program is running? CHances are that id you bring up the Windows Task Manager the Labview.exe will be consuming all available CPU time.

What I have done here is setup the DAQ task for you using the DAQmx vi's. This is done outside the while loop. All that is then done in the while loop is to read the samples taken from the buffer (system RAM). This should alleviate a lot of load on the CPU. This is more for a troubleshooting measure at the moment. You should hopefully see some performance increase.
If this is the case then we can look at simplifying the writing data to disk. This should give you a bigger increase as file I/O is one of the more time consuming aspects of PC's.

So run the modified VI below and let me know if you see an improvement.

Best regards,
Matt Poole | Applications Engineer | National Instruments
0 Kudos
Message 4 of 5
(3,133 Views)
Hi,
Thanks for all your information and im sorry i havent replied yet. It dosent help progress when i cant always get access to the laptop with the programme on! Maybe i should invest in a PCMCIA to PCI converter....
Anyway, i have been playing with the programme and trying to improve things. I have also had a look at the 2 things you mentioned. When the VI is running and not recording, the CPU usage is on 100% and the page file on about half. For some reason, when i start the recording, the CPU usage drops down and fluctuates between 95% and 100%!!? I have increased page file space and that didnt seem to help. I have managed to get my version of the VI to run reasonably well, it displays all 6 graphs quite ok normally but when i start to record, it still struggles a little. Its not really that much of a problem tho cos it saves all the data ok and so i can shove it into a spreadsheet. I have attached a screen dump of what the outputs look like when it is recording.
I have also had a look at the (very complicated!) programme that you posted. I tried to run it and it actually didnt seem to work as well at first! I then noticed that someof the settings were different (differential not RSE etc) so started changing it around and the best output i could get was actually using the same settings as i have from the original VI, and the quality of the graphs were no better. I have it set to take n samples instead of continuous, does this really make any difference? Since the n samples setting works, is there any reason why i shouldnt use that?
My next task is to try and add a filter to the system to take out the very high frequency disturbances. I connected the sensors for the first time today and they are picking up too much vibration. (the sensors are 3 accelerometers and 3 gyros to measure the 6 degrees of freedom of a vehicle. They pick up my hand shaking!) I tried to add a simple low-pass filter set at 100Hz but it made the graph do strange things. It went down to 0 at regular intervals. To do with the n samples setting perhaps?
Anyway, thanks again, i really appreciate it.
I will get there eventually!
Andrew
0 Kudos
Message 5 of 5
(3,107 Views)