Depending on the resolution required and by setting the CCP registers manually, the hardware is capable of running up into the MHz region.
Depending on the resolution required and by setting the CCP registers manually, the hardware is capable of running up into the MHz region.
I have updated my code to this:
I still get 40.1KHz and I have not affected CCP registers manuallyCode:@ __config _XT_OSC & _WDT_OFF & _MCLRE_ON & _LVP_OFF & _CP_OFF CLEAR DEFINE OSC 4 TRISB = $05 CMCON = $07 HPWM 1,127,40000 MAIN: pause 1 GOTO MAIN end
When working with hardware peripherals (such as CCP/PWM, USART, etc.) I will set up the registers manually - that way I know exactly what the peripheral is doing. You will also save a significant amount of code space by not having the compiler/device perform what can sometimes be pretty math intensive operations.
Bookmarks