[Flashforth-devel] Fwd: PWM at PIC18F2620
Brought to you by:
oh2aun
From: Thomas B. <bus...@gm...> - 2014-07-21 21:21:54
|
---------- Forwarded message ---------- From: Thomas Buschhardt <bus...@gm...> Date: 2014-07-21 23:21 GMT+02:00 Subject: Re: [Flashforth-devel] PWM at PIC18F2620 To: Mikael Nordman <mik...@pp...> Hallo, thats a correct failure :-) But after changing the value to the correct RB3, nothing happens. I tested also with 100% dutycycle but no signal came from this pin. I use also the values of this calculator: http://www.micro-examples.com/public/microex-navig/doc/097-pwm-calculator.html, but no luck. Thanks Thomas 2014-07-21 22:53 GMT+02:00 Mikael Nordman <mik...@pp...>: > Are sure you are using rb3 ? > > > > Your code is making rb2 an output. > > > > Mike > > Sent from my LG Mobile > > > > > > ------ Original message------ > > *From: *Thomas Buschhardt > > *Date: *Mon, 21/07/2014 19:53 > > *To: *flashforth-devel; > > *Subject:*[Flashforth-devel] PWM at PIC18F2620 > > > 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> > > > ------------------------------------------------------------------------------ > Want fast and easy access to all the code in your enterprise? Index and > search up to 200,000 lines of code with a free copy of Black Duck > Code Sight - the same software that powers the world's largest code > search on Ohloh, the Black Duck Open Hub! Try it now. > http://p.sf.net/sfu/bds > _______________________________________________ > Flashforth-devel mailing list > Fla...@li... > https://lists.sourceforge.net/lists/listinfo/flashforth-devel > > -- www.aloedb.org - database for aloes -- www.aloedb.org - database for aloes |