LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Quick DAQ Assistant Help

Hello, I am a little new to LabVIEW and have tried to do something that is probably very simple in order to learn, but at this point I think I need help.


If you view my files attached, I have a DAQ unit that records voltages from a Power Supply and basically the graph displays real-time voltage pretty smoothly. What I want in addition to this is an output excel file that records one data point of voltage for every second such that in a single Excel column, we would have something like:

 

2.3 V

3.4 V

3.5 V 

etc. in which each voltage is separated by a second. It would also be ideal if I was able to specify how long this data recording would go on for (e.g. 15 seconds). 

So of course the first thing that came to mind was using a for loop and use some function in the "timing" palette to separate each iteration of the loop by a second but I am getting errors, and have no idea what the proper wiring should be. I am also aware of the write to measurement file command but am having trouble putting them all together.

 

Any guidance would be appreciated!

Download All
0 Kudos
Message 1 of 4
(2,189 Views)

If you are getting errors, then you should tell us what those errors are.  A picture of the message or at least an error number.

 

You have your DAQ assistant set up to read at 1000 samples, but are only reading 1 at a time.  Why don't you read more?  Perhaps 100 at a time?

 

Or if you read 1000 at a time, you could average them and write that value out to your file.

0 Kudos
Message 2 of 4
(2,182 Views)

Yes that was a confusing point for me. According to the tooltip - "When you select Continous, NI-DAQmx uses Samples to Read and Rate (Hz) to determine buffer size." This led me to believe that Samples to Read is only relevant in N samples mode where it will actually collect 100 samples when you request 100 samples. However, in Continuous mode, isn't specifying a number a little abstract? From my script, there isn't a set number of samples to collect...

 

As I am writing this, I changed the Samples to Read to 100 and the real time graph became more "jerky" and less smooth while I changed voltage with my power supply (not literally smooth as in slopes of the graph but the response itself) so I am not sure how this impacts anything although the averaging does sound promising; again I am new so I am just saying what comes to mind.

 

Yes, I will post what I have tried so far and associated errors soon..., thanks!

0 Kudos
Message 3 of 4
(2,174 Views)

The number of samples to read is the number of samples you want to read in one chunk.  If you tried reading only one at a time, your loop needs to run at least 1000 times per second to keep up.  But you'd have no benefit since the user can't see screen updates that fast.  They can only see updates at about 30 Hz.  Read 100 samples at 1000 Hz means it is updating every 1/10 of a second or 10Hz.  It is a decent balance.  It shouldn't look that jerky to you.  But if you want it to look a little smoother, try reading 30 samples.    Screen update rate would then be 33.3 Hz.

 

Since you only want to output 1 sample per second to the file, you need to figure out which of those 1000 samples you get during a second you want to output, whether it is the lowest, highest, first, last, or the average of them.

0 Kudos
Message 4 of 4
(2,158 Views)