2 counters on UE9


Graphic

Recommended Posts

hi i'm using 2 rotory encoder that can give me pulses. now i thought that the UE9 count use 2 counter and FIO0 and FIO1 would get replaced by those counters. now here my problem. i can only get FIO0 to work. i get nothing when i put it on FIO1.\

so if i have 2 channels. both counters, one on FIO0 and one on FIO1. it should work. shouldn't it

i have no timers enabled so the counters aren't moved by them.

i have no idea anymore

thnx IA

CounterTest.ctl

Link to comment
Share on other sites

  • 8 months later...

OK, first you probably should avoid using D# 0. D# 0 was provided mostly for people used to using the U12, but with the addition of first found in the device configuration, you should avoid it. The reason is that if you get another UE9 or U3 (and so are using 2 labjack devices on the same PC) you'll can't use D# 0 at all and so you'd have to go back through your code and change every instance. If, instead, you had used first found in device configuration with a D# of 1 say, then all you'd have to do is replace this listing with an actual ID number, and all your instances / code would update.

Now, as to your question, the problem is simply that you didn't enable both counters in your ResetCounters sequence (which, by the way, is misnamed, as the code inside only enables the counters and doesn't reset them). The code you want is:

device.LabJack.AddRequest(0,"LJ_ioPUT_COUNTER_ENABLE",0,1,0,0)

device.LabJack.AddRequest(0,"LJ_ioPUT_COUNTER_ENABLE",1,1,0,0)

device.Labjack.GoOne(0)

Alternatively, if you use the device configuration instead of D#0 you can enable the counters from there without any code.

Link to comment
Share on other sites

Archived

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