Jump to content

As of July 17, 2015, the LabJack forums here at forums.labjack.com are shut down. New registrations, topics, and replies are disabled. All forums are in a read-only state for archive purposes.

Please visit our current forums at labjack.com/forums to view and make new posts. To post on the current forums, use your labjack.com login account. Your old LabJack forums login credentials have been retired. There are no longer separate logins for labjack.com and LabJack forums.


Photo

I have gone through the examples and still have no idea how to gather data with LabJack

LabVIEW Data Acquisition

  • Please log in to reply
6 replies to this topic

#1 Samuel Goodall

Samuel Goodall
  • Members
  • 17 posts

Posted 27 November 2013 - 07:00 PM

I have read, and re-read the examples over multiple days and am still unable to gather data from LabJack. Honestly feeling pretty thick and frustrated at the moment. So let's say that I wanted to sample AI0 and AI1 using simple command/response like in Log (The AILogger example doesn't work on my laptop due to some missing files but I doubt this is the main impedance on my quest to get this working). 

 

I think I want to run LJAI twice, once for AI0 and once for AI1 though I'm not sure how to pick the individual input or how the command works in general in block diagram form. I guess I then find the difference of the two inputs to get my Voltage? My analysis code works for an analog waveform and I know that there must be a way that the Voltage data could be altered as such I just don't how I would go about doing it, I've been trying to combine the 'voltage data' with some 'time data' in an array but LabVIEW is saying that the LJAI input is a cluster of three elements and I just don't know what is going on.

 

Let's say I wanted to get 10 minutes of sample time, so I stick in an Elapsed Time clock combined with a comparison to have a while loop that runs for 600 seconds. Does that sound accurate for getting the timer for the data acquisition right?

 

In short do you have an example which has no data processing or imaging just shows how the inputs of the LabJack are actually accessed and what format the data is sent through the system as? 

 

Many thanks and sorry I'm a mess.



#2 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 28 November 2013 - 10:27 AM

First, understand that LabVIEW is not a ready-to-run application.  LabVIEW is a full-blown programming language ... very similar to C except it uses graphics to write a program rather than text.  If you are not familiar with LabVIEW, you need to go through the LabVIEW tutorials provided by NI.  In addition to the basics, sounds like for your application you need to learn about loops and arrays.  Also go through information on clusters.

 

If you wanted to collect data once per second for 10 minutes you would use command-response mode.  You could call EAnalogIn twice in a while loop that runs once per second for 10 minutes:

 

http://labjack.com/s...users-guide/4.1

 

From other topics, though, it sounds like you need to use stream mode on your U12 to collect data faster.  First read about the stream functions:

 

http://labjack.com/s...users-guide/4.8

http://labjack.com/s...users-guide/4.9

http://labjack.com/s...sers-guide/4.10

 

Before you try programming on your own in LabVIEW, I suggest you run LJstream.exe to collect data as desired for 10 minutes.  This will give you a feel for collecting data in stream mode:

 

http://labjack.com/s...users-guide/3.6

http://labjack.com/s...mples/ljstream2

 

Now go to LabVIEW.  LJstream is actually written in LabVIEW, but I would not attempt to modify the source code if you are a LabVIEW beginner.  Instead, start with "simple ai stream example.vi".  This example demonstrates continuous streaming.  From what you describe, features you might want to add to this example are:

 

    - Log data to file.

    - Stop after 10 minutes.



#3 Samuel Goodall

Samuel Goodall
  • Members
  • 17 posts

Posted 28 November 2013 - 07:22 PM

Is there a particular reason why in both of the examples the Voltages provided trend to infinity (in demo mode)?



#4 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 29 November 2013 - 09:22 AM

No particular reason.  Demo mode is designed so you can develop and run your code without a U12 attached.  Any returned data is meaningless.  It looks like in stream mode you get different things depending on how many channels you stream.  I don't have access to the driver source at the moment, so will leave this tagged to look up those details and add them to Sections 4.8 & 4.9.



#5 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 29 November 2013 - 05:06 PM

Added the following to Section 4.8:

 

If demo is TRUE, the 1st channel will return the scan count. If readCount is FALSE, depending on numChannels the other channels will return a random value in the +/-5V range or a constant -2.5V. If readCount is TRUE the other channels return the current time.



#6 Samuel Goodall

Samuel Goodall
  • Members
  • 17 posts

Posted 01 December 2013 - 04:26 PM

Thanks, it being the scan count make significantly more sense. So if the readCount is TRUE the other channels return the current time and the 1st channel returns a voltage?



#7 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 01 December 2013 - 08:55 PM

If demo is FALSE and readCount is TRUE:  The first channel returns an analog input voltage, the other 3 channels return the 32-bit value from the counter:

 

http://labjack.com/s...users-guide/4.8

 

http://labjack.com/s...users-guide/2.5

 

 

If demo is TRUE and readCount is TRUE:  The first channel returns the scan count.  The other 3 channels return a 32-bit value which is system time.  Probably seconds since 1904.





Also tagged with one or more of these keywords: LabVIEW, Data Acquisition

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users