View previous topic :: View next topic |
Author |
Message |
enigmagazi
Joined: 20 Sep 2011 Posts: 2
|
QEI subtitute 32 bit (How do I count the 90000) |
Posted: Tue Sep 20, 2011 2:19 am |
|
|
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.
|
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9240 Location: Greensville,Ontario
|
|
Posted: Tue Sep 20, 2011 6:03 am |
|
|
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
|
|
Posted: Tue Sep 20, 2011 6:15 am |
|
|
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 |
|
|
|