Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Position measurement doesn't roll over correctly

0 views
Skip to first unread message

SirMutt

unread,
Aug 11, 2008, 5:10:07 PM8/11/08
to
I'm trying to measure position (in tick counts, not angle).  I set the Z index, counts per revolution, and initial position.  If I have 400,000 counts in one revolution and Z index of 40,000 (since I'm using X4, I have to enter 10,000 which is odd), I can never get a position less than 40,000.  Rather than rolling from 400,000 to 1 and starting to count up, it just keeps counting up until the next home pulse at which is then goes to 40,000.  So, in this example, it goes from 440,000 to 40,000.  Now, I could compensate for this with math, but it's more problematic when rotating counter clockwise because rather than going 3, 2, 1, 400000, it goes 3, 2, 1, 4294967296, 4294967295...  It's a lot less pleasant having to deal with 2^32.  Still could deal with it though.
 
Why doesn't the counter reset to 0 when rotating clockwise or 400,000 when rotating counter clockwise.  I would expect the only valid range for data to be 0 to 400,000 and it would roll over when it reached one of those limits.  But I can't make it work that way.  Am I missing something?
 
Thanks.

lion-o

unread,
Aug 12, 2008, 7:10:09 PM8/12/08
to
Hi SirMutt,I assume that you are basing your program off the Measure Angular Position.vi example found in NI Example Finder and changing it to return U32. If you're doing something different, please let me know. From your explanation, it sounds like you want a Z index of 0 and not 40,000. Could you explain why you decided to use 40,000? Did you just want to set an initial angle? If so you may want to set the initial angle input instead. If you make that change, I believe the screenshot below is an easy implementation to map the 399,999 to -399,999 to a 0 to 399,999. Please let me know if this helps!<img src="http://forums.ni.com/attachments/ni/40/6656/1/conversion2.jpg"> Message Edited by lion-o on 08-12-2008 05:49 PM


conversion2.jpg:
http://forums.ni.com/attachments/ni/40/6656/1/conversion2.jpg

0 new messages