LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

continuous voltage acquisition and write to spreadsheet

I am trying to acquire input and out put voltage using USB 6212 and labview 8.5.
What i need to do is i want to acuire the input and output analog voltages and write a spreadsheet. But the thing is, I want it to write to the file at the rate of about 25 samples every 2 mins till the output voltage is in a certain range.
Once it goes above or below the range, the data should be written more frequently to the spreadhseet till the output voltage comes back to the required range.
Can anyone help me with this. Also i wanted the continuous voltage acquisiton and write to spreadhseet (not CSV) file example. Labview on my computer had a bug recently and I have lost all the shipped examples.
It will be great if someone could help me with this problem ASAP.
Thanks.
0 Kudos
Message 1 of 12
(5,070 Views)
Hi Smm,

One possible solution is to decimate the data array comming out of the DAQmx Read VI or the DAQ Assistant Express VI. For example, if your number of samples is 1000 and you're sampling at 1000Hz, then you're getting 1000 samples every second. Therefore, you want to save every 1000/12.5 = 80th data. You can use Decimate 1D Array VI to do this. By using case structure, you can set when you want to decimate the array depending on your output voltage level.

I'm not sure what you mean by "write to spreadsheet (not CSV)". The Write To Spreadsheet File VI in LabVIEW does write data in a CSV file format. However, you can open easily CSV files with Excel.

What bug are you refering to causes all the shipping examples to disappear? LabVIEW shipping examples can be very helpful. Are you able to repair LabVIEW using Add/Remove Programs.

Regards,
Stanley Hu
National Instruments
Applications Engineering
http://www.ni.com/support
0 Kudos
Message 2 of 12
(5,042 Views)


stanthetiger wrote:
Hi Smm,

One possible solution is to decimate the data array comming out of the DAQmx Read VI or the DAQ Assistant Express VI. For example, if your number of samples is 1000 and you're sampling at 1000Hz, then you're getting 1000 samples every second. Therefore, you want to save every 1000/12.5 = 80th data. You can use Decimate 1D Array VI to do this. By using case structure, you can set when you want to decimate the array depending on your output voltage level.

I'm not sure what you mean by "write to spreadsheet (not CSV)". The Write To Spreadsheet File VI in LabVIEW does write data in a CSV file format. However, you can open easily CSV files with Excel.

What bug are you refering to causes all the shipping examples to disappear? LabVIEW shipping examples can be very helpful. Are you able to repair LabVIEW using Add/Remove Programs.

Regards,
Stanley Hu
National Instruments
Applications Engineering
http://www.ni.com/support


The only example I had of write to spreadsheet wrote to a CSV file. I wanted it to write to any spreadsheet like excel.
When I got the last update for 8.5, apparenlty some software was corrupt (we got a letter from NI after the update was complete). Since then Labview started giving me multiple problem like hanging up, not running the application. Finally when I could run the program after re installation, I saw that I started getting an error cannot find WIn32 rte file for examples or something.
 
I'm using the NI USB 6216. Can you tell me if I can directly use values like 100, 110 etc for comparing incoming voltage. Because I think the DAQ cannot handle such haigh values. So do I need to step down the acquired voltages to test?
0 Kudos
Message 3 of 12
(5,038 Views)
Hi Smm,

When you write to a CSV file format, you should be able to open it with any spreadsheet program like Excel.

Which letter are you refering to? The only one I can remember is the DAQmx 8.6.0f12 update, which is unrelated to LabVIEW. I'm not sure what you mean by last update of LabVIEW 8.5. LabVIEW 8.5 has been the same (no updates, patches, etc) ever since it was shipped.

The voltage range of the USB-6216 is +/-10V. If you need to aquire signals above the specified range, you would need to condition the signal or else the DAQ card would break.

Regards,
Stanley Hu
National Instruments
Applications Engineering
http://www.ni.com/support
0 Kudos
Message 4 of 12
(5,030 Views)

ya the same letter. it is unrelated i agree, but since that update all these starnge things happened to labview on my computer. Anyways that is kind of under control now.

I have attached a code here. Should these values be between 0 and 10V instead of 180-300 or 197-218? I can get some external hardware conditioning done in order to step down the voltage.

Also could you tell me how can i change the path of the file name?

0 Kudos
Message 5 of 12
(5,024 Views)
Hi Smm,

Yeah, you would need to step down the voltage. The data coming out of DAQmx Read should be between 0V to 10V. You can do the necessary conversion after you get the data from DAQmx Read depending on how much you attenuate the signal. For example, if you step down your voltage by a factor of 10 with your external hardware, then you can multiply the voltage reading coming out of DAQmx Read by 10 to get the orignal voltage value before you step down the signal.

Regards,
Stanley Hu
National Instruments
Applications Engineering
http://www.ni.com/support
0 Kudos
Message 6 of 12
(5,016 Views)

Yeah that makes sense.

But for these other questions:

1)How can you change the path of the file.

2) I want to be able to write all values in the spreadsheet (whether they lie in the specified threshold range or not). Only the no. of pts. written vary. If they are in the range then they should write maybe about 25 pts. But if the values go outside the range it should write all values till the readings come inside the range.

How can I modify the code to do that?

 

0 Kudos
Message 7 of 12
(5,014 Views)
Hi smm,

1) To change the path of the file, you just need to click on the folder box of the path indicator on your front panel.

2) You just need to add code your true and false cases of your structure.  So if you want to write only 25 points to the spreadsheet file when the voltage level is outside the range, then in the case structure you would decimate the voltage data before writing to a spreadsheet file.

Regards,
Stanley Hu
National Instruments
Applications Engineering
http://www.ni.com/support
0 Kudos
Message 8 of 12
(4,987 Views)

No. I want to be able to write all the points to the spreadsheet that lie outside the range. When they lie in the rnage then it should write about 25 pts.

What do you mean by decimate? Do you think you could show it to me in my VI if possible.

Thanks,

Shreya

0 Kudos
Message 9 of 12
(4,985 Views)
Hi smm,

Sorry, I meant to say write 25 points when they lie in the range. I've attached a simple that illustrates what I have said.

Regards,
Stanley Hu
National Instruments
Applications Engineering
http://www.ni.com/support
0 Kudos
Message 10 of 12
(4,982 Views)