Showing results for 
Search instead for 
Did you mean: 

Limit range of a encoder

Hello all,


Problem: I use a DAQ Assistant input with a counter and a connected encoder. I'm only counting the actual degree value in relation to the start value (so a relative measurement). I only want the encoder to give values between -360° to 360°.

I can limit these numeric values for sure, but the counter always continues counting, even when the limit is reached.  That means that I'm only seeing my +- 360°, which is correct, but when one limit is reached and I count on (it still shows 360°) the encoder itself will continue to count without showing me this, resulting in counting backwards for a long time before getting back in the value range I set.


Is there any way to limit the counter input directly? So that it only counts up to 360° and then instantly (starting at 360°) back, even when I have turned more than 360?


I hope you understand my problem, I did many hours of research on this topic but without a solution.


Best regards, thank you in advance.

0 Kudos
Message 1 of 4

Add 360 to your counter value, divide by 720 with the function quotient and remainder, subtract 360 from the remainder value.


Regards, Jens

Kudos are welcome...
0 Kudos
Message 2 of 4

Thanks. Can you make a example VI? If I make the function mentioned by you, I get a jump from -360 to 360 when reaching the limit -360.

What I asked is if my value can lock at the value of 360/-360 and then go back when I turn the encoder in the other direction (f.ex. CW), but cant go any further than the value I mentioned when I turn in the same direction (f.ex. CCW).
Sorry if there was any misunderstanding.

0 Kudos
Message 3 of 4

First off, why would you want to intentionally lose track of where the encoder is 'telling' you where you are?  That is like saying I only want an odometer to tell me when I move forward or backwards up to a mile then you drive 20 miles down the road and back up 1/10th of a mile and have the odometer display 0.9 miles travelled.  I would recommend having an indicator noting that max travel has been exceeded that way you know that the travel indication is missing data.  If you can tell if your encoder is moving CW or CCW, then the rest of the code is simple.

Now, can you provide your current code?

Help the Community (and future reviewers) by marking posts as follows:
If it helped - KUDOS
If it answers the issue - SOLUTION
0 Kudos
Message 4 of 4