EasyManuals Logo

LabJack U3 User Manual

LabJack U3
120 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #68 background imageLoading...
Page #68 background image
The following pseudocode demonstrates reading input timers/counters and updating the values
tions
add/go/get block so that a single low-level call is
sed.
cycle to 25%.
R_VALUE, 0, 49152, 0);
/Read duty-cycle from Timer1.
32-bit value where the
gni cant ts the high time
os signi presents the low
e mes r er of cycles of
k.
00 * s));
blHighTime = 0.000001 * dblHighCycles;
t value.
llowing is pseudocode to reset the input timer and the counter:
same Add/Go/Get block),
e read will return the value just before reset.
ed with U3 hardware
ate.
of output timers. The e-functions are used in the following pseudocode, but some applica
might combine the following calls into a single
u
//Change Timer0 PWM duty
ePut (lngHandle, LJ_ioPUT_
TIME
/
eGet (lngHandle, LJ_ioGET_TIMER, 1, &dblValue, 0);
/The duty cycle read returns a /
/
/least si fi word (LSW) represen
//and the m t ficant word (MSW) re
//time. Th ti eturned are the numb
//the timer lo In this case the timec c r clock was set
//to 1 MHz, so each cycle is 1 microsecond.
dblHighCycles = (double)(((unsigned long)dblValue) % (65536));
dblLowCycles = (double)(((unsigned long)dblValue) / (65536));
dblDutyCycle = 1 dblHighCycles / (dblHighCycles + dblLowCycle
d
dblLowTime = 0.000001 * dblLowCycles;
//Read the count from Counter1. This is an unsigned 32-bi
eGet (lngHandle, LJ_ioGET_COUNTER, 1, &dblValue, 0);
Fo
//Reset the duty-cycle measurement (Timer1) to zero, by writing
//a value of zero. The duty-cycle measurement is continuously
//updated, so a reset is normally not needed, but one reason
//to reset to zero is to detect whether there has been a new
//measurement or not.
ePut (lngHandle, LJ_ioPUT_TIMER_VALUE, 1, 0, 0);
//Reset Counter1 to zero.
ePut (lngHandle, LJ_ioPUT_COUNTER_R
ESET, 1, 1, 0);
Note that if a timer/counter is read and reset at the same time (in the
th
4.3.7 Stream Mode
The highest input data rates are obtained in stream mode, which is support
version 1.21 or higher. See Section 3.2 for more information about stream mode.
There are five IOTypes used to control streaming:
_ioCLEAR_STREAM_CHANNELS LJ
LJ_ioADD_STREAM_CHANNEL
LJ_ioADD_STREAM_CHANNEL_DIFF //Put negative channel in x1.
J_ioSTART_STREAM //Value returns actual scan r
L
LJ_ioSTOP_STREAM
LJ_ioGET_STREAM_DATA
68

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the LabJack U3 and is the answer not in the manual?

LabJack U3 Specifications

General IconGeneral
Analog Outputs2
Analog Output Resolution10 bits
Digital I/O20
Counter/Timers2
InterfaceUSB
Operating Voltage5 V
ManufacturerLabJack Corporation
Analog Inputs16
Analog Input Resolution12-bit
Max Sample Rate50 kHz