I'll bet at least on the configuration fuses settings... AND... is there any specific reason why you want to run your PIC @ 32KHz?
i didn't did the calc, but i feel your current setting doesn't work anyways...
try the following
Sorry, ASM is really not my cup of teaCode:list p=16f88 INCLUDE "p16f88.inc" ; Program Configuration Register 1 __CONFIG _CONFIG1, _CP_OFF & _CCP1_RB0 & _DEBUG_OFF & _WRT_PROTECT_OFF & _CPD_OFF & _LVP_OFF & _BODEN_OFF & _MCLR_OFF & _PWRTE_OFF & _WDT_OFF & _INTRC_IO ; Program Configuration Register 2 __CONFIG _CONFIG2, _IESO_OFF & _FCMEN_OFF errorlevel -302 ; disable ' ensure .. bank pouet pouet' warning message BANKSEL OSCCON MOVLW B'01100000' MOVWF OSCCON ; 4 MHz INT CLOCK MODE BTFSS OSCCON,IOFS ; wait 'till int osc is stable GOTO $-1 BANKSEL PORTB CLRF PORTB ; Clear all CLRF PORTA ; outputs BANKSEL TRISA CLRF TRISA ; all pins set to output CLRF TRISB ; BANKSEL ANSEL CLRF ANSEL ; Disable all ADCs ; ; PWM Setup ; --------- BANKSEL PR2 movlw .249 ; ~250Hz PWM FREQUENCY movwf PR2 BANKSEL T2CON movlw b'00000111' ; prescaler 1:16, Timer2=on movwf T2CON BANKSEL CCP1CON movlw b'00001100' ; pwm mode movwf CCP1CON Start BANKSEL CCPR1L movlw .250 movwf CCPR1L ; set duty cycle to ~max, 100% Loop1 ; ((10+bananas) *250) uSec delay loop ; to provide slower fading effect goto $+1 goto $+1 goto $+1 goto $+1 goto $+1 DECFSZ W,F GOTO Loop1 decfsz CCPR1L,F ; dimming led by varying the duty cycle goto Loop1 goto Start endSo i'll not be surprised if some comes with a better solution, or with some constructive comments on the above (apart that i should care a little bit more about the bank switching... i feel there's a few useless BANKSEL here and there... that's what happen when you're lazy
)
<hr>
Please, next time, try to not double, triple post the same question on various forum section.


So i'll not be surprised if some comes with a better solution, or with some constructive comments on the above (apart that i should care a little bit more about the bank switching... i feel there's a few useless BANKSEL here and there... that's what happen when you're lazy
)


Bookmarks