U6 frequency measurement | LabJack
 

U6 frequency measurement

4 posts / 0 new
Last post
Ahtif
Ahtif's picture
U6 frequency measurement

I have a U6 pro device. I would like to enable timer0 and timer1, so to my understanding, they should appear on FIO0 and FIO1. I use FIO0 as PWM output pin and I need to measure pulsed signal frequency on FIO1. Is it possible?

Currently, I do not get any serious results.

LabJack Support
labjack support's picture
Be sure that the Pin Offset

Be sure that the Pin Offset is set to zero. If you still have problems check out our examples: https://labjack.com/support/software/examples

Ahtif
Ahtif's picture
Got it work, example helped a

Got it work, example helped a lot.

Thanks.

LabJack Support
labjack support's picture
Timer0 and Timer1 will appear

Timer0 and Timer1 will appear on FIO0 and FIO1 of the U6 if PinOffset=0.

As for frequency measurement ... in general timing individual pulses is best for lower frequencies, whereas counting over time is best for higher frequencies:

https://forums.labjack.com/index.php?showtopic=1105

A great way to measure frequency is by timing individual pulses using Timer mode 2 which is 32-bit Period Measurement:

https://labjack.com/support/datasheets/u6/hardware-description/timers-co...

The U6 has 4 timers, but the total edge rate is limited to 30000 edges per second:

https://labjack.com/support/datasheets/u6/hardware-description/timers-co...

I suggest you test as follows using the test panel in LJControlPanel:

Jumper FIO0 to FIO1 to FIO2.  FIO0 will be a frequency output, FIO1 will be period input, and FIO2 will be a counter input:

TimerClockBase = 48 MHz    (no divisor, so each clock tick is 1/48M => 0.0000000208333 seconds)

#TimersEnabled=2
Timer0:  Mode=PWM16, Value=32768
Timer1:  Mode=RISINGEDGES32

Counter1=Enabled

PinOffset=0    (timers & counters will start at FIO0)

Timer0 will be a 732.42 Hz PWM signal with 50% duty cycle:

https://labjack.com/support/datasheets/u6/hardware-description/timers-co...

Timer1 is measuring the period from rising edge to rising edge.  It is jumpered to Timer0 so the number of clock ticks we will measure is 48000000/732.42 = 65536, which you can see is happening in my attached screenshot.

The test panel in LJCP iterates about once per second, so Counter1 will increment by about 732 counts each time.