CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

QEI subtitute 32 bit (How do I count the 90000)

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
enigmagazi



Joined: 20 Sep 2011
Posts: 2

View user's profile Send private message Visit poster's website

QEI subtitute 32 bit (How do I count the 90000)
PostPosted: Tue Sep 20, 2011 2:19 am     Reply with quote

hi everybody

I am use QEI module and reading encoder position but qei_get_count(); count only 65535 and return to 0 but I count 90000

How do I count the 90000 please help... sorry for bad english write.

MY chip 18F4431.

Sad
temtronic



Joined: 01 Jul 2010
Posts: 9240
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue Sep 20, 2011 6:03 am     Reply with quote

I don't use that PIC but...
some options...

1)use an external counter( US Digital make them)...

2)keep a 'rollover' counter.It stores the # of 65536 counts....

3)use X1 instead of X4..(1 rotation would be 360 cts not 1440).

I use #1, though 2 is great if you need lots of counts, #3 if you can afford to lose the resolution
Ttelmah



Joined: 11 Mar 2010
Posts: 19535

View user's profile Send private message

PostPosted: Tue Sep 20, 2011 6:15 am     Reply with quote

The QEI _hardware_ only counts 16 bits.
However it will generate a QEI interrupt, when the count wraps at the ends of the scale.
So use the QEI interrupt, and if it occurs when the direction is 'up' increment the top part of a 32bit value, or when 'down', decrement this.

Best Wishes
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group