Timer setup


Jariv

Recommended Posts

Hi,

I'm trying to set up one timer (timer0) and one counter (counter1).

For some reason the code below activates the counter1 fine, but the table view for timer channel (ch#0) only shows times increasing as it should, but the value column remains 0.

using("device.labjack.")

include("c:\program files\labjack\drivers\labjackud.h")

global ID = 0

ePut(ID, LJ_ioPIN_CONFIGURATION_RESET, 0, 0, 0)

AddRequest (ID, LJ_ioPUT_CONFIG, LJ_chTIMER_COUNTER_PIN_OFFSET, 4, 0, 0)

AddRequest(ID, LJ_ioPUT_COUNTER_ENABLE,0,1,0,0)

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

AddRequest(ID, LJ_ioPUT_TIMER_MODE, 0, LJ_tmRISINGEDGES16, 0, 0)

AddRequest(ID, LJ_ioPUT_CONFIG, LJ_chTIMER_CLOCK_BASE, LJ_tc48MHZ_DIV, 0, 0)

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

GoOne(ID)

Any idea where the mistake is?

Jari V

Link to comment
Share on other sites

I don't see anything wrong. All these commands, and most others are simply passed through to the LabJack UD. A notable exception is streaming commands. Because they are just pass throughs, any issues would lie in the UD and I think the LabJack folks would be better able to answer the fine details of the UD.

That said, there are three things I'd do:

1) triple check my wiring, ensuring that I was actually grounding my timer. Also, make sure that my signal is big enough to actually trigger the timer

2) run the examples referenced in the DAQFactory-LabJack application guide with one timer, and separately with one counter. After you do one timer, repeat it with TIMER_COUNTER_PIN_OFFSET set to 5 so you are sure about the wiring once you enable both

3) mess around with the order of the commands. This may or may not help, but I'd certainly try moving the timer clock stuff to before the enabling of the counters/timers. Obviously, configuration reset belongs at the top, and pin offset should probably be just below. I don't know if it makes a difference, but I'd still try it. I've seen it make a difference in other non-LabJack hardware.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.