Please enable JavaScript to view this site.

DAQFactory User's Guide

Navigation: 17 Devices > 17.7 LabJack UE9 / U6 / U3 > 17.7.6 Counters and Timers > 17.7.6.5 Setting up Specific Timer Modes

17.7.6.5.4 Firmware Counter In

Scroll Prev Top Next More

This Timer mode works similar to a counter, but uses an interrupt routine to increment the counter so can't handle real high speed counts, and has a bit more internal overhead than a regular counter. Setting it up is basically the same as period in:

1) Enable a Timer:

 

AddRequest(ID, LJ_ioPUT_CONFIG, LJ_chNUMBER_TIMERS_ENABLED, 1, 0, 0)

2) Set the mode:

 

AddRequest(ID, LJ_ioPUT_TIMER_MODE, 0, LJ_tmFIRMCOUNTER, 0, 0)

3) Set the clock frequency and divisor:

 
// use system clock so works on U3 and UE9:

AddRequest(ID, LJ_ioPUT_CONFIG, LJ_chTIMER_CLOCK_BASE, LJ_tcSYS, 0, 0)
AddRequest(ID, LJ_ioPUT_CONFIG, LJ_chTIMER_CLOCK_DIVISOR, 48, 0, 0)

4) GoOne() to actually execute the commands:

 

GoOne(ID)

5) Create a channel to read the Timer.  I/O Type is Timer, Channel # is the timer #, in this case 0.

You can reset the timer to 0 by using LJ_ioPUT_TIMER_VALUE, put please read the section on resetting counters and how to get around it.

 

AddRequest(ID, LJ_ioPUT_TIMER_VALUE, 0, 0, 0, 0)