LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how do you use labjack with labview?

I need to use LabJack U12 with labview but i am confused. I have two basic setups to achieve. The first will be a signal generator connected to the LabJack which in turn is connected to the PC. I want to be able to produce a waveform on the PC just as if an Oscilloscope is used. secondly i will have a power supply, connected to a cell(a fabricated device) which in turn is connected to the LabJack. My aim is to produce a graph of voltage vs. time on the PC. For both setups i will like to be able to produce graphical displays on the PC instead of on an Oscilloscope. How do i achieve this with LabView while using the LabJack U12. I am using Lab View 6.0 Thank you
0 Kudos
Message 1 of 15
(16,676 Views)
The first place to look for getting started with the U12 and LabVIEW is the following topic on the LabJack forum:
 
 
For a function generator using an analog output, look at the sample program LJfg.exe, and see the source code in "LJfg.vi".  Keep in mind that the update rate of the analog outputs on the U12 are limited to about 50 Hz as described here:
 
 
That page also describes analog input rate limits.  For burst mode, look at "LJscope.vi" or "simple aiburst.vi".  For stream mode look at "LJstream.vi" or "simple ai stream example.vi".  For command/response, look at various examples including "simple eanalogin loop with chart.vi".
 
Message 2 of 15
(16,661 Views)
Hi, I want to use LabJack U12 on my LabVIEW 8.6 Professional Development System. Can someone help me? Thanks.
0 Kudos
Message 3 of 15
(16,111 Views)

hex-

 

         Look one post above yours 🙂 If you click on that link about getting started with LabVIEW and LabJACK, you can bump up one thread section and just get to the basic LabVIEW section of their forums. It seems like there is a lot of information here and there are apparently examples (I got this from that getting started link) that LabJACK ships with that show example code of dealing with LabVIEW. I don't have any experience with dealing with LabJACK but I think that this is going to be your best point of contact (Although LabJACKSupport, I would think knows a little bit about it :))

 

Grant

0 Kudos
Message 4 of 15
(16,074 Views)
Right on Grant.  Use that link to get started.
0 Kudos
Message 5 of 15
(16,066 Views)
Hahaha...It works! Thanks friends!
0 Kudos
Message 6 of 15
(16,035 Views)

I'm trying to use a Labjack U13 on a Mac and with Labview 8.5 Professional Development System. On this platform there are no drivers so I have been writing my own using the VISA functions. I have managed to get command/response to work fine but I need to use the Stream mode for better timing accuracy.

 

I can configure the stream, start it and stop it without any difficulty but I can not read any data while the stream is running. Regardless of the timeout period (anything from 100ms to 10s) the VISA Read function keeps returning Timeout errors with a Return count of 0.

 

Does anyone have any suggestions on what's wrong or where I should start looking next? 

 

Thanks in advance. 

0 Kudos
Message 7 of 15
(15,911 Views)

I believe you are talking about the LabJack U3, correct?
 
As an alternative, from our forum it looks some people have dabbled with using CIN (code interface nodes) to connect a U3 with our Linux driver (which is very similar to our Mac driver):
 
http://www.labjack.com/forums/index.php?showtopic=2934
 
I am not familiar with using VISA to do USB.  Does that mean you are not using our Mac drivers at all, but rather VISA handles opening the device and lets you connect to the different pipes to pass raw data in and out?  Did you notice (from Section 2.1 of the U3 User's Guide) that stream data comes in on Endpoint 3, unlike all other data to the host that comes in on Endpoint 2?

 

Note that the last paragraph of Section 2.1 has typos.  It should say:

 

"All commands should always be sent on Endpoint 1, and the responses to commands will always be on Endpoint 2.  Endpoint 3 is only used to send stream data from the U3 to the host."

0 Kudos
Message 8 of 15
(15,900 Views)

Thanks for that. 🙂

 

Yes, it should be a U3.

 

I'll have a look down the Linux track should I have too many more problems.

 

Ah, I do remember having read that bit about endpoints. I figured I'd missed a trick somewhere and that makes sense now. 

0 Kudos
Message 9 of 15
(15,896 Views)

Nothing I have been trying the last few days has gotten Labview 8.6 or 9.0 to play nice with the Labjack.

 

I have written many small programs now with Labview and Xcode that work well (enough) using the CIN interface.

 

I have written many small programs now with Xcode that work well using the Labjack

 

When I write programs using Labview's CIN interface in Xcode that use Labjack code it does not work, the programs (of any complexity) compile, they even execute from Labview, but any hardware related functions just don't seem to do anything.

 

 

 

 

PLEASE HELP!!!!

 

 

example code:

 

/* this program runs great, it senses the labjack U3.*/

/* all the example programs witht he labjack also work and easily accept modification to output voltage read data etc*/

/* the program below is based off of this one but will not execute labjack functions ::shakes fist!!!::  */

 

#include <stdio.h>
#include "labjackusb.h"

int main (int argc, const char * argv[]) {
    char str[80];
     
    sprintf(str, "How many LabJacks are connected?\n");
   
    int numU3s = LJUSB_GetDevCount(U3_PRODUCT_ID);
    int numU6s = LJUSB_GetDevCount(U6_PRODUCT_ID);
    int numUE9s = LJUSB_GetDevCount(UE9_PRODUCT_ID);
   
    sprintf(str,"%sU3s: %d\n", str, numU3s);
    sprintf(str,"%sU6s: %d\n", str, numU6s);
    sprintf(str,"%sUE9s: %d\n", str, numUE9s);
    puts (str);
       
    return 0;
}
 

 

 

 

 

/* CIN source file does not work as it should */
/ * executes in Labview but outputs 0 instead of 1 */

 

#include "extcode.h"
#include <stdlib.h>
#include "labjackusb.h"

CIN MgErr CINRun(LStrHandle arg1);


CIN MgErr CINRun(LStrHandle arg1) {

    /* ENTER YOUR CODE HERE */
    /* simple code to set DAC0 value to arbitrary value. 0.05 - 4.95V */ 
   
    LStrPrintf(arg1,"How many LabJacks are connected?\n");

    int numU3s = LJUSB_GetDevCount(U3_PRODUCT_ID);
    //int numU6s = LJUSB_GetDevCount(U6_PRODUCT_ID);
    //int numUE9s = LJUSB_GetDevCount(UE9_PRODUCT_ID);
   
    LStrPrintf(arg1,"U3s: %i\n", numU3s);
    //sprintf(str,"%sU6s: %d\n", numU6s);
    //sprintf(str,"%sUE9s: %d\n",  numUE9s);
   
    MgErr err;
   
    goto done;
       
close:   
    return err;
    //closeUSBConnection(hDevice);
done:
   
    return noErr;
}

0 Kudos
Message 10 of 15
(14,994 Views)