Quadrature encoder in Labjack U6

Hi Chris,

One other request that has gotten to be a bit of a high priority for us.
(I’m sorry if this is a duplicate: I thought I had sent this to you around July 17th but I can’t find any record of that, so I’m resending.)

We would like to use the quadrature encoder mode of the labjack counter. Is this something you could easily add for us?
Ideally, we’d have a counter on FIO4/FIO5 configured to count up and down in quadrature input mode.

Thanks,
Mark

Hi Mark,

Yes, I could add that. Lindsey’s version of the U6 plugin uses quadrature input (which I believe I added, although my memory is hazy), so it should be straightforward to add it to yours, too. How soon do you need it?

Chris

Hi Chris,
Thanks!

This quadrature input feature is the highest priority item for us right
now. Not an emergency, but Josh is waiting on it to try some experimental
things.

Mark

Hi Mark,

I’m working on this now. Quick question:

Ideally, we’d have a counter on FIO4/FIO5 configured to count up and down in quadrature input mode.

Currently, FIO4/FIO5 are used for lever2 and lever2_solenoid. Are you saying you want me to remove those and replace them with the quadrature input?

Thanks,
Chris

Yes. That would be fine. Thanks. Mark

Hi Mark,

This is implemented now (code on this branch). It seems to work correctly, except that the first quadrature transition is not reported. For example, if the initial state of the input pins is 0/0, transitioning to 1/0 does not result in a reported change to the quadrature value. However, subsequently transitioning to 1/1 causes the quadrature value to increment by 1 as expected, and all subsequent transitions work as well.

It’s possible that there’s a bug in the code somewhere, or that this is somehow expected behavior. However, it also reminds me of the counter issue you reported recently, where MWorks doesn’t receive the first counter update. In any case, I’m going to investigate further. In the meantime, if Josh wants to start testing/using the code as is, that should be fine, as long as he bears this issue in mind.

Cheers,
Chris

Excellent, thank you!

And yes, that first tick issue is reminiscent of our counter issue. In the counter case, the counter starts at 0, and the first transition to 1 isn’t reported in MWorks. The next event we see is the transition to 2. So presumably something is keeping track of the transition to 1 that happens, it’s just not getting reported.
Let us know if we can provide additional information about that or other issues.

Mark

ps thanks for this - we are testing!
Let us know if we can help you track down this issue.

Hi Mark,

I haven’t made any progress on the first transition issue. Have you seen it, too? My next step is to get in touch with LabJack to see if it’s expected behavior, but I haven’t done that yet.

Chris

We have seen that transition issue with the counter. It seems to have cropped up in the last year or so, so I don’t think it is a hardware issue. Do you have an old mac you could try it with? I really don’t think it’s a hardware input issue the way the pulses are timed, but we could ask Bradley to measure the input pulses if needed.

thanks!
Mark

Hi Mark,

We have seen that transition issue with the counter. It seems to have cropped up in the last year or so, so I don’t think it is a hardware issue.

Sorry, I was referring to the first quadrature transition issue, which I mentioned previously. If you’ve tested the quadrature stuff, have you seen that issue, too?

I haven’t observed the missing first counter update in my testing.

Chris

I haven’t observed the missing first counter update in my testing.

Hmm. In a few weeks we’d like you to remote in and take a look, then. I don’t know what could be going on.

Re: the quadrature transition issue, which may or may not be related, we’ll let you know this week if we see it.

thanks,
Mark

Hi Mark,

In a few weeks we’d like you to remote in and take a look, then. I don’t know what could be going on.

OK. In the meantime, if you want to send me an experiment that exhibits the missing-first-counter-update issue, I can try some more to reproduce it on my end.

Thanks,
Chris