If I want to change the order of the keys so that key0 = 1/0 (RB2), key1 = down(RB1), and key2 = up(RB0) do I need to un-remark the
;key0=portb.0=ch0, key1=portb.1=ch1, key2=portb.2=ch2 statement and change it, or do I need to change the code in the main portion of the program?
comments are just that ,they only serve to show what it is that the programmer decides need an explanation . they don't get compiled or participate in the execution of the code in any way. to change the way the keys are interpreted requires a change the code .


right now I am only getting a momentary break in the pwm when it is touched
my mistake the pw var should also be set to zero too when killing the light

In the debug setup, all I need to do is monitor the pin specified with Serial Communicator or Hyperterminal
I use a pickit2 to pgm/debug with ,the debug statements suit my setup . if you use a real rs232 port to debug then a rs232/ttl level converter needs to be used and the logic level may need to be inverted [rtfm]

Is there any way I can get the 1/0 button to toggle between off and full pwm,
should be easy , hint "FINITE STATE MACHINE"


what did your "threshold" count need to be ?
why not explore a "limited slew rate filter" to automatically track and adjust the threshold value . or more reliable yet, automatically track and adjust the threshold value for each individual key