Re: [Flashforth-devel] PWM at PIC18F2620
Brought to you by:
oh2aun
From: Mikael N. <mik...@pp...> - 2014-07-21 20:53:32
|
<div style="font-size:10pt;"><p style="margin-top:0;margin-bottom:0;">Are sure you are using rb3 ?</p><p style="margin-top:0;margin-bottom:0;"> </p><p style="margin-top:0;margin-bottom:0;">Your code is making rb2 an output.</p><p style="margin-top:0;margin-bottom:0;"> </p><div><signature_tag><p style="margin-top:0;margin-bottom:0;">Mike</p><p style="margin-top:0;margin-bottom:0;">Sent from my LG Mobile</p></signature_tag></div><p id="last_enter" style="margin-top:0;margin-bottom:0;"> </p><p style="margin-top:0;margin-bottom:0;"> </p><p style="margin-top:0;margin-bottom:0;">------ Original message------</p> <p style="margin-top:0;margin-bottom:0;"><b>From: </b>Thomas Buschhardt<bus...@gm...></p><p style="margin-top:0;margin-bottom:0;"><b>Date: </b>Mon, 21/07/2014 19:53</p><p style="margin-top:0;margin-bottom:0;"><b>To: </b>flashforth-devel;</p><p style="margin-top:0;margin-bottom:0;"><b>Subject:</b>[Flashforth-devel] PWM at PIC18F2620</p><p style="margin-top:0;margin-bottom:0;"> </p><div dir="ltr">Hallo FFFans,<div><br></div><div>I try to run PWM on a PIC18F2620 with no success (I dont see any spike in the logic analyzer). Here are my parameters:</div><div><br></div><div>Tosc 8 MHz</div><div>Periode: 36 KHz</div> <div>Duty Cycle: 25%</div><div>Output is RB3/CCP2 Pin24</div><div>Pre- Postscaler: 1</div><div><br></div><div>And here my Programm:</div><div><br></div><div><div><font face="courier new, monospace">-pwm</font></div><div><font face="courier new, monospace">marker -pwm</font></div> <div><font face="courier new, monospace">$ff81 constant portb</font></div><div><font face="courier new, monospace">$ff93 constant trisb</font></div><div><font face="courier new, monospace">$ffba constant ccp2con</font></div> <div><font face="courier new, monospace">$ffcb constant pr2</font></div><div><font face="courier new, monospace">$ffbb constant ccpr2l</font></div><div><font face="courier new, monospace">$ffcc constant tmr2</font></div><div> <font face="courier new, monospace">$ffca constant t2con</font></div><div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace">: init</font></div><div><font face="courier new, monospace">\ Set the PWM period by writing to the PR2 register.</font></div> <div><font face="courier new, monospace">%00110110 pr2 c! \ #54 Periode: 0,0000275 s / Prescaler: 1 / Tosc: 8MHz</font></div><div><font face="courier new, monospace">\ Set PWM dutycycle to the CCPR2L register and CCP2CON<5:4> bits</font></div> <div><font face="courier new, monospace">\ dutycyle: 25% = #56 (10bit) = %0000 1110 00</font></div><div><font face="courier new, monospace">%00001110 ccpr2l c!</font></div><div><font face="courier new, monospace">%00110000 ccp2con mclr</font></div> <div><font face="courier new, monospace">\ Make the CCP2 pin an output by clearing the appropriate TRIS bit.</font></div><div><font face="courier new, monospace">\ RB3/CCP2 output</font></div><div><font face="courier new, monospace">%00000100 trisb mclr</font></div> <div><font face="courier new, monospace">\ Set the TMR2 prescale value, then enable Timer2 by writing to T2CON.</font></div><div><font face="courier new, monospace">0 tmr2 c! \ reset tmr2</font></div><div><font face="courier new, monospace">%00000100 t2con c! \ prescale 1, timer2 is on</font></div> <div><font face="courier new, monospace">\ Configure the CCPx module for PWM operation.</font></div><div><span style="font-family:'courier new',monospace">%00001100 ccp2con c!</span><br></div><div><font face="courier new, monospace">;</font></div> </div><div><br></div><div>What I missed ?</div><div><br></div><div>Thank you for looking.</div><div>Thomas</div><div>-- <br><div>We have a IRC-Channel #flashforth on <a href="http://freenode.org">freenode.org</a>.</div><div> WebIRC-Client is <a href="http://webchat.freenode.net?randomnick=1&channels=%23flashforth&uio=d4">here</a></div> </div></div> </div> |