NL2TTL,
Seems everyone is forgetting the analog ports these days.
ADCON1 = $0F
Added: It will probably be better to have subroutines that set the dutycycle of the CCP modules. Then call them only when needed.
Continually setting the registers in the main loop may cause some problems, and isn't needed since the hardware will continue putting out the PWM while the main program is doing other things.
Also, by using these statements Duty3 = Gval *2, it effectively reduces the PWM resolution to 9-bit since bit0 will always be 0.
Added2: The RB3/CCP2 pin is the alternate CCP2 output. You'll need to change the CCPMX configuration fuse for it to work there.
<br>
Bookmarks