Thread: 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> |
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 |
From: Mikael N. <mik...@pp...> - 2014-07-22 05:13:04
|
There is a device configuration bit, CCP2MX, that determines if RC1 or RB3 is used for the CCP2 module. Mike |
From: Thomas B. <bus...@gm...> - 2014-07-22 05:52:42
|
Dear Mikael, ok I see its in the p18f2525-2620-4525-4620.cfg. Its any possibility to read/change configurationsbit within FF? Because its situated on memoryposition 300005h. Greetings Thomas 2014-07-22 7:12 GMT+02:00 Mikael Nordman <mik...@pp...>: > There is a device configuration bit, CCP2MX, that determines if > RC1 or RB3 is used for the CCP2 module. > > Mike > > > > ------------------------------------------------------------------------------ > 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 |
From: Mikael N. <mik...@pp...> - 2014-08-01 05:06:46
|
It is not possible to change configuration bits from within flashforth. You have to do it in configuration file. |