Hi Hank,
Usually it's done like this:Now, the resolution you'll actually get depends on the frequency you're using as well as the prescaler ratio. You MAY end up with 9 or 10 bits resolution in which case you must scale up "your" 8 bit dutycycle value to match the resolution of the hardware. Otherwise you might not be able to "swing" the dutycyle all the way to 100% - if that's what you need.Code:CCP2CON.4 = Duty.0 'Bit 0 CCP2CON.5 = Duty.1 'Bit 1 CCPR2L = Duty >> 2 'Bit 2-7
Have you checkes out Darrels MIBAM routine? Never played with myself but it's supposed to do wonders for multiple fading LEDs.
/Henrik.




Bookmarks