Configuring and Reading Timers [U3/U6/UE9] | LabJack
 
« Close

Datasheets and User Guides

App Notes

Software & Driver

 

Configuring and Reading Timers [U3/U6/UE9]

Timer features on UD devices can easily be configured and read without custom software by using our LJControlPanel and LJLogUD/LJStreamUD software on Windows.

Configuring Timers in LJControlPanel

  1. Configure a counter.

    If you are using an input timer (period measurement etc.), we recommend you first configure a counter and get it to increment properly before attempting to configure a timer.
     
  2. Open the device in LJControlPanel.

    Follow steps 1-6 in our U3/U6/UE9 Quickstart Tutorials.
     
  3. Click the "Config" button in the Timer/Counter section of the test panel.

    Once pressed a new window should appear with more timer and counter settings.


     
  4. Enable your timers.

    For this tutorial we will set up a firmware counter on Timer 0, but note that there are several other timer options available. See the timer/counter datasheet page of your respective device for more information: U3/U6/UE9.

    Set "# of Timers Enabled" to 1 and change the mode of Timer 0 to FIRMCOUNTER.


     
  5. Set the "Pin Offset".

    set the "Pin Offset" box to 4 to put Timer 0 on FIO4. Note that the minimum pin offset for the U3 is 4; see the timer datasheet page linked in step 3. for more information.


     
  6. [Optional] Change the timer clock frequency and divisor.

    Selecting a clock base with a divisor will automatically pop up a window for modifying the TimerClockDivisor as shown below.


     
  7. Click "OK".

    The smaller timer/counter window should close and you should now see your timer value incrementing if you have a good pulse input attached to the timer DIO pin. If you are unsure if you have a good pulse input, a jumper wire clamped in a GND terminal should produce increments when you tap the other end of the wire to the inside-back of the timer/counter DIO pin terminal[1].


     
  8. [Optional] Advanced testing.

    For more advanced testing of other features such as frequency input and PWM output, multiple timers and counters could be configured. For example, PWM output (PWM16 or PWM8 modes) could be configured on Timer 0 with frequency input (modes such as RISINGEDGE32) configured on Timer 1. Connecting a jumper wire between the Timer 0 and Timer 1 DIO ports and watching the output in the test panel should then show that the PWM is outputting the desired test frequency on Timer 1.
     
  9. [Optional] Save your timers and counters in your startup configuration.

    To save your timers and counters for startup you must set up the timers/counters in the "Config Defaults" tab of LJControlPanel rather than the test panel.

    First close the test panel and click "Config Defaults".


    Set up all of your timer/counter settings.


    Click "Write Values". A new window will pop up; Click "Yes" to save your configuration.


    Close LJCP and power cycle the device to apply your changes. Note that the test panel will not load your configurations, so we recommend you test the feature in LJLogUD.  You can also come back to the Config Defaults screen in LJCP to see if it shows the power up defaults you set.

[1] LabJack digital inputs have an internal 100k pull-up that weakly holds them high, so when you connect a GND wire to a digital input it will pull the line low and create a falling edge. When you pull out the wire you get a rising edge.  You are not likely to make a perfectly clean single contact, so a counter will typically increment many counts each time you tap the wire.  Also note that you should touch the ground wire to the inside-back of the counter terminal.

Next Step:

Once you are all set up with your timers and counters you can move on to Logging Timers/Counters.