LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Need help with data acquisition for NI MyRIO 1900

Solved!
Go to solution

Hello guys!

 

So, straight to the point. I've been trying to figure out how to make the VI for data acquisition with NI MyRIO 1900. The purpose is to measure the voltage on a breadboard, using the AI0 channel on the MyRIO, and save it with "Write to measurement file". When I am trying to run the examples from the "help" function, everything works out well, but I can't seem to implement the knowledge to my own coding.

I was wondering if someone could help me out, with how to measure the voltage as analog input and then save the acquired data on my PC.

 

I've attached the code for the data acquisition.

0 Kudos
Message 1 of 6
(2,028 Views)

BTW, it's made with LabVIEW 2016 32-bit.

0 Kudos
Message 2 of 6
(2,022 Views)

Well it looks like you are taking a single sample, multiplying it by 12, then saving that single value to a file and then immediately trying to read another sample then overwriting the file with the new single value.  Is this what you want to be doing?  Or would you rather be appending values to the file?  A better design might be to acquire N values, then log them all at once, or keep them in a buffer of some kind.  Not sure if the example had a wait in your while loop but you probably should have one otherwise you are using up tons of File I/O and CPU resources doing nothing.  Beyond that I think what you wrote should work.  If you want to append to the file, double click the Write TO Measurement File and select Append instead of overwrite.

 

Here are a bunch of LabVIEW training links if you want to dive in deeper and understand what is going on.  The examples are great starting points but at some point you need to understand what is happening and an express VI is just a black box that has a ton of code behind it doing magic.  Easy to get started with, but hard to get to do what you want if you want anything specific.

 

 

NI Learning Center

NI Getting Started

-Hardware Basics

-MyRIO Project Essentials Guide (lots of good simple circuits with links to youtube demonstrations)

-LabVEW Basics

-DAQ Application Tutorials

-cRIO Developer's Guide 

Learn NI Training Resource Videos

6 Hour LabVIEW Introduction
Self Paced training for students
Self Paced training beginner to advanced, SSP Required

0 Kudos
Message 3 of 6
(2,008 Views)

I hope it's clear to you that a MyRIO is a computer of it's own - with it's own OS and HDD.

 

Regards, Jens

Kudos are welcome...
0 Kudos
Message 4 of 6
(2,003 Views)

Thanks for the reply!

 

The idea was to be able to press start in the VI, and then the code would start taking measurements and when the stop button was pressed, all the data acquired would be saved to one single file.

The voltage measurements are measured over a voltage divider, which is the reason behind the multiplification of 12, to get the correct value, which then should be saved (Or stored) in the write to measurement file.

The example I was looking at, was taking a measurement every 10 iteration in a "for loop". I think that you're right about it taking up too much CPU, and therefore have to change it to take measurements according to some time value.

So quick summary of my idea:

 

Start measuring -> Store the data (buffer maybe) -> Press stop after 10sec. -> Save the data to an excel file.

 

So, any quick fixes to take a measurement every 10-20th iteration? And saving ALL the data acquired from measurements when pressing stop?

 

Thank you very much for your help!

0 Kudos
Message 5 of 6
(1,998 Views)
Solution
Accepted by topic author Cyperimer

jg69 has a good point.  I hope you know that the file (or files) created won't be on your computer, they will be saved in a folder on the myRIO's hard drive.  You will likely need to Webdav into it to get the files.  I'd recommend creating an indicator on that path data type and see what the full path is that it is being saved to.

 

Attached is an updated version that might help.  I don't have the MyRIO software installed so I don't know how that read is configured, but this code will read 20 samples, graphing them as they come in, but then once it gets 20 of them, logs them all at once appending to an existing file.  You can increase this delay, or increase the number of samples as needed.  I also removed the sequence structure cause it didn't do anything for you but was probably part of the example.

0 Kudos
Message 6 of 6
(1,980 Views)