View Single Post
  #7   Spotlight this post!  
Unread 10-02-2008, 00:09
ldeffenb ldeffenb is offline
Registered User
AKA: Lynn Deffenbaugh (Mr)
None #0386 (Team Voltage 386)
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2003
Location: Florida
Posts: 75
ldeffenb has a spectacular aura aboutldeffenb has a spectacular aura aboutldeffenb has a spectacular aura about
Send a message via ICQ to ldeffenb Send a message via AIM to ldeffenb Send a message via Yahoo to ldeffenb
Re: New C18 3.0+ Compatible FRC Code

Quote:
Originally Posted by 1jbinder View Post
...They are Encoder_3_State, Encoder_4_State, Encoder_5_State, and Encoder_6_State. Do you know where these variables are declared.
Look at lines 70-86 (at least in my copy) of encoder.c. You'll see the declarations there.
Quote:
Originally Posted by 1jbinder View Post
.
Also why are the encoder 3-4 ISR's different from the encoder 5-6 ISR's.
From Kevin's encoder_readme.txt from 2 years ago:

Encoder channels one and two are optimized for velocity control
and will generate the least number of interrupts per encoder
count (one per encoder count). These channels may have problems
in position control applications because they can be fooled
into thinking that the encoder shaft is rotating if the shaft
happens to stop very near a phase-A transition and then wobbles
back and forth across that transition.

Encoder channels three and four are optimized for position
control. For these channels, software examines both transitions
of phase-A and can't be fooled into miscounting the number
of encoder counts. The downside to using these channels is that
for a given encoder, they will generate twice the number of
interrupts as channels one and two (two per encoder count).

Encoder channels five and six are just like channels three and
four, but offer the bonus of increasing the precision of your
encoder by a factor of two for free. Unlike channels one
through four, which will increment or decrement on each rising
(zero to one) transition, these two channels will increment or
decrement on both transitions of phase-A. In other words, if
you attach a 64 count-per-revolution encoder to one of these
two channels, you'll read 128 counts when you rotate the shaft
exactly one revolution.