LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabJack Data Collection

Hello!

So my team and I are new to LabVIEW and are having some issues with our data collection, so sorry if this is a simpler question. We had the system able to collect data and append it to a csv file from the start up from the program. However, our goal is to make this loop occur only when a button is pressed using an entered time value, only giving data from that time forwards. We also are wanting this to be repeatable during one run (our previous loop worked only if we ended the run). The current structure builds an array equal to the desired data collection time, then appends that array to our file. We tried working it with loops and case structures but cannot seem to figure it out, so any suggestions would be appreciated! We also plan to expand this collection with three more data entries but their structure should be essentially identical to this first one. 

 

As an aside, our system that appends values to the array seems to only append integers requiring us to have the extra multiply by 10000 step, if you know how to make that a floating number so we skip that little bit of math we would also appreciate that.

 

All the best,

Logan Holler

Oregon State University

0 Kudos
Message 1 of 4
(814 Views)

A couple of comments/suggestions:

  • You are using some external functions ("LIMxxx") that I know nothing about.  I'm guessing that AIN0 means "Analog Input", and delivers you floating point samples, but I have no idea of how you set # of samples and Sampling Rate, but it does look like your While Loop generates one Dbl data point every 50 ms (or a sampling rate of 20 Hz).
  • LabVIEW lends itself to "Debug your code Yourself".  Replace that loop with a loop that generates a random number (scaled appropriately for your data -- you shouldn't need to multiply it by 100000, only to divide it by the same amount in a subsequent loop).  
  • Your Data Collection loop (the first loop) seems to run until you stop it.  It doesn't, for example, provide "samples of 100 points every 5 seconds until I tell the Program to stop".  Try modifying your "Test Data Acquisition Loop" to do this.  Hint -- replace the While Loop with a For Loop and wire ??? (figure it out) to the Loop counter, N.
  • The next loop is the Data Saving Loop.  When you write LabVIEW code, always have wires running left-to-right (look at the wire going into "Write Data to File", which goes in on the right).  Since you are in "Write "Proof of Concept" code, get rid of the Case Statement and write all of the data.  
  • Why are you transposing the array of data points?  What is the "box" around "Write Data to File"?  Doesn't look like any LabVIEW Structure that I know.  Do not deliberately "obscurify" (that's a new word I just made up) your LabVIEW code.
  • Aha!  Now I get the answer to why you transposed the data -- you are trying to write a 2-column, many rows .csv file with Time in the first column and Data in the second.  How is "Time Recorded" set?  [Again, a simulated smaller routine might suggest a different, possibly better, design].

I'd go "back to the Drawing Board" and write a simple routine that generates "fake data" at your desired data rate and lets you start and stop saving of the data.  Try not to "fancy up" your Block Diagrams with pretty colored boxes that look like LabVIEW Structures (but are pure fluff).

 

Bob Schor

0 Kudos
Message 2 of 4
(796 Views)

Hello Logan,

 

It sounds like you need help with LabVIEW programming in general, nothing specific to LabJack, but if you want us to check something out take & post a screenshot as we don't have new enough LabVIEW to open your VI that reports version 21.0.

 

 

Hello Bob,

 

Sounds like you are seeing calls to the LJM Library that supports our T-series devices:

https://labjack.com/pages/support?doc=/software-driver/ljm-users-guide/

 

I'm guessing you are looking at a call to eReadName.  You pass the name of a single register ("AIN0" is indeed analog input 0) and it returns 1 reading.  We call this a command-response or software-timed function, as the timing is controlled by the software not our hardware.

https://labjack.com/pages/support?doc=/software-driver/ljm-users-guide/ereadname/

 

0 Kudos
Message 3 of 4
(723 Views)

Hello, Jack.  Thanks for the followup post, and for your offer to help out the Original Poster.  It's always a Good Sign when a vendor helps the user/customer make successful use of the Product.

 

Bob Schor

0 Kudos
Message 4 of 4
(706 Views)