encoder.c

I’m trying to understand encoder.c. When the left encoder’s phase-A signal changes from 0 to 1, it triggers an interrupt, which invokes Left_Encoder_Int_Handler() in encoder.c. Left_Encoder_Int_Handler() determines the direction of rotation, and hence either increments or decrements Left_Encoder_Count, based on the value of rc_dig_in06 (the encoder’s phase-B signal) at the time of the interrupt. When (and where) is rc_dig_in06 updated so that it has the current value when it is looked up in Left_Encoder_Int_Handler()? What variables are updated in Process_Data_From_Master_uP() in main.c every 26ms?

Thanks.

Gary,

I believe rc_dig_in06 is just an alias which maps directly to the address of the appropriate PORT on the PIC. This usually means that there is no need to actively update it. You should be able to access them anywhere at any time and they should return updated values without much problem.

The PWM variables (pwm01, pwm02, etc) are a different matter, and I believe those are the ones you are referring to as being updated by Process_Data_From_Master_uP() in main.c every 26ms.

-SlimBoJones…

rc_dig_in06 is always updated. Consider it a direct connection to the seventh digital input on the RC.

Anything that comes from the OI. That’s mostly the joystick/switch inputs and the competition mode bits, plus things like user_display_mode which is changed by pressing the little button under the display on the OI.