[Flashforth-devel] PWM at PIC18F2620
Brought to you by:
oh2aun
From: Thomas B. <bus...@gm...> - 2014-07-21 16:52:56
|
Hallo FFFans, I try to run PWM on a PIC18F2620 with no success (I dont see any spike in the logic analyzer). Here are my parameters: Tosc 8 MHz Periode: 36 KHz Duty Cycle: 25% Output is RB3/CCP2 Pin24 Pre- Postscaler: 1 And here my Programm: -pwm marker -pwm $ff81 constant portb $ff93 constant trisb $ffba constant ccp2con $ffcb constant pr2 $ffbb constant ccpr2l $ffcc constant tmr2 $ffca constant t2con : init \ Set the PWM period by writing to the PR2 register. %00110110 pr2 c! \ #54 Periode: 0,0000275 s / Prescaler: 1 / Tosc: 8MHz \ Set PWM dutycycle to the CCPR2L register and CCP2CON<5:4> bits \ dutycyle: 25% = #56 (10bit) = %0000 1110 00 %00001110 ccpr2l c! %00110000 ccp2con mclr \ Make the CCP2 pin an output by clearing the appropriate TRIS bit. \ RB3/CCP2 output %00000100 trisb mclr \ Set the TMR2 prescale value, then enable Timer2 by writing to T2CON. 0 tmr2 c! \ reset tmr2 %00000100 t2con c! \ prescale 1, timer2 is on \ Configure the CCPx module for PWM operation. %00001100 ccp2con c! ; What I missed ? Thank you for looking. Thomas -- We have a IRC-Channel #flashforth on freenode.org. WebIRC-Client is here <http://webchat.freenode.net?randomnick=1&channels=%23flashforth&uio=d4> |