5.0

5.0 | 1 rating Rate this file 17 Downloads (last 30 days) File Size: 4.66 KB File ID: #27597

LabJackU3

by

 

This function simplifies talking to a labjack U3.

| Watch this File

File Information
Description

Must have MATLAB_LJUD.zip file from
http://labjack.com/support/ud/examples/matlab
and 'LJUD_Functions' folder must be on path or in the current directory

inputs:
op operation to perform, options are:
temperature - read internal temp in Kelvin
AnalogIn,N
read single-ended analog input from channel N
AnalogInDiff,N1,N2
read differential analog input from channels: N1-N2
AnalogOut,N1,N2
set analog output channel N1 (0 or 1) to voltage N2
DigitalIn,N - read 0 or 1 on channel N
DigitalOut,N1,N2
set channel N1 to digital value N2 (0 or 1)
StreamAnalogIn,N1,N2,N3
stream from channel N1 (can be array of multiple channels) at rate N2 samples/sec for total of N3 seconds

varargin - currently no options

examples:
T = LabJackU3('temperature')
% return internal temperature
V2 = LabJackU3('AnalogIn',2)
% return AIN2-GND voltage
V6to5 = LabJackU3('AnalogInDiff',6,5)
% return AIN6-AIN5 voltage
LabJackU3('AnalogOut',1,3)
% set DAC1 to 3 volts
D4 = LabJackU3('DigitalIn',4)
% read voltage of 0 or 1 on FIO4
LabJackU3('DigitalOut',5)
% set voltage to 0 or 1 on FIO5
[time,V1]=LabJackU3('StreamAnalogIn',1,1000,.3);
% stream AIN1 at 1000 Hz for 0.3 seconds
[time,Vs]=LabJackU3('StreamAnalogIn',[0,1],5000,1.5);
% stream both AIN0 & AIN1 at 5000 Hz for 1.5 seconds

MATLAB release MATLAB 7.4 (R2007a)
Other requirements Need a labjack U3 and code from the labjack website.
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (1)
25 Mar 2011 Lowell Toms

Excellent job! Makes streaming a piece of cake!

Contact us