This is what i have:
; damn "example" says nothing about which interrupt vector or BANK to use ; NEEDS FIXING, "BANKSEL 0" and BANKSEL 1" issue SAME CODE BANKSEL 1 ; to get at INTCON, PIE1, PR2, TRISB MOVLW d'255' ; (PR2+1)*Timer2 prescalar value*Tcy ; 256 * 1 *(4/20e6) or
200nSec MOVWF PR2 ; 51.2uSec PWM period or about 19.5kHz ; Timer 2 ON, fastest scale, 10 bit resolution; MS 8 used BANKSEL 0 ; to get at INTCON, PIR1, TMR2, T2CON, CCPR1L, CCPR1H, CCP1CON MOVLW 0x04 ; TMR2ON bit; prescale & postscale bits = 0 MOVWF T2CON ; enable TMR2 with prescaler = 1 MOVLW 0x0F ; M0 to M3 all set MOVWF CCP1CON ; Activate PWM mode BANKSEL 1 ; to get at INTCON, PIE1, PR2, TRISB BCF TRISB,TRISB3 ; clear for PWM output pin 9 RB3 BANKSEL 0 ; to get at INTCON, PIR1, TMR2, T2CON, CCPR1L, CCPR1H, CCP1CON ; Nothing found in manual about these three. ; v---INTerrupt CONtrol BSF INTCON,PEIE ; set bit 6 PEripheral Interrupt Enable BCF PIR1,TMR2IF ; clear bit 1 Peripheral Interrupt Register ; TiMeR 2 Interrupt FlagMOVLW D'0' ; zero PW MOVWF CCPR1L
Help?