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 #67 background imageLoading...
Page #67 background image
LJ_tmRISINGEDGES16 //Period input (16-bit, rising edge
J_tmFALLINGEDGES16 //Period input (16-bit, falling edges)
s)
IOTypes, to configure a
_chNUMBER_TIMERS_ENABLED
ith the clock base special channel above, the following constants are passed in the value
clock base
nter0)
r0)
r0)
Counter0)
llowing is example pseudocode for configuring various timers and a hardware counter:
nfiguration_reset IOType so that all
pin assignments are in the factory default condition.
used, which combines the add/go/get.
ters.
UT_CONFIG, LJ_chTIMER_COUNTER_PIN_OFFSET, 2, 0, 0);
LED, 2, 0, 0);
isabled.
_ioPUT_COUNTER_ENABLE, 0, 0, 0, 0);
ill use the next available line, FIO4.
andle, LJ_ioPUT_COUNTER_ENABLE, 1, 1, 0, 0);
e the same timer clock, configured here. The
o 24MHZ_DIV, meaning that the clock divisor
ounter0 is not available.
;
ock.
OR, 24, 0, 0);
uency
, 0);
s .
L
The following are special channels, used with the get/put config
parameter that applies to all timers/counters:
LJ
LJ_chTIMER_CLOCK_BASE
J_chTIMER_CLOCK_DIVISOR
L
LJ_chTIMER_COUNTER_PIN_OFFSET
W
parameter to select the frequency:
J_tc2MHZ //2 MHz clock base L
LJ_tc6MHZ //6 MHz
LJ_tc24MHZ //24 MHz clock base
J_tc500KHZ_DIV //500 kHz clock base w/ divisor (no Cou
L
LJ_tc2MHZ_DIV //2 MHz clock base w/ divisor (no Counte
Counte
LJ_tc6MHZ_DIV //6 MHz clock base w/ divisor (no
24 MHz clock base w/ divisor (no
LJ_tc24MHZ_DIV //
Fo
//Execute the pin_co
//
//The ePut function is
ePut (lngHandle, LJ_ioPIN_CONFIGURATION_RESET, 0, 0, 0);
//First, an add/go/get block to configure the timers and coun
//Set the pin offset to 2, which causes the timers to start on FIO2.
AddRequest (lngHandle, LJ_ioP
//Enable both timers. They will use FIO2-FIO3
ddRequest (lngHandle, LJ_ioPUT_CONFIG, LJ_chNUMBER_TIMERS_ENAB
A
//Make sure Counter0 is d
AddRequest (lngHandle, LJ
/Enable Counter1. It w
/
AddRequest (lngH
us
//All output timers
t
//base clock is set
/is supported and C
/
A
ddRequest (lngHandle, LJ_ioPUT_CONFIG, LJ_chTIMER_CLOCK_BASE, LJ_tc24MHZ_DIV, 0, 0)
//Set the timer clock divisor to 24, creating a 1 MHz timer cl
ddRequest (lngHandle, LJ_ioPUT_CONFIG, LJ_chTIMER_CLOCK_DIVIS
A
q
//Configure Timer0 as 8-bit PWM. It will have a fre
2 Hz.
//of 1M/256 = 3906. 5
AddRequest (lngHandle, LJ_ioPUT_TIMER_MODE, 0, LJ_tmPWM8, 0, 0);
//Initialize the 8-bit PWM with a 50% duty cycle.
AddRequest (lngHandle, LJ_ioPUT_TIMER_VALUE, 0, 32768, 0, 0);
//Configure Timer1 as duty cycle input.
Handl , LJ_i
AddRequest (lng e oPUT_TIMER_MODE, 1, LJ_tmDUTYCYCLE, 0
//Execute the reque ts
GoOne (lngHandle);
67

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