EmbeddedRelated.com
Forums

PIC PWM registers

Started by BrunoG May 4, 2006
Hi,

I wrote a PWM calculator and code generator :

http://www.micro-examples.com/public/microex-navig/doc/097-pwm-calculator.html

This may help anyone fighting with PIC PWM registers calculations...

Questions & comments are welcome

Bruno



In article <4459d34d$0$19719$8fcfb975@news.wanadoo.fr>,
 "BrunoG" <noreply@micro-examples.com> wrote:

> http://www.micro-examples.com/public/microex-navig/doc/097-pwm-calculator.html
I tried it and the code window was blank. Specs were: 4MHz, 400Hz and 50%. Al
"Al" <no.spam@wanted.com> a &#4294967295;crit dans le message de news: 
no.spam-9FF667.09003404052006@news.verizon.net...
> In article <4459d34d$0$19719$8fcfb975@news.wanadoo.fr>, > "BrunoG" <noreply@micro-examples.com> wrote: > >> http://www.micro-examples.com/public/microex-navig/doc/097-pwm-calculator.html > > I tried it and the code window was blank. > > > Specs were: 4MHz, 400Hz and 50%. > > Al
Hi Al, I tried with your specs, this is what you should have got : /* * PWM registers configuration * Fosc = 4000000 Hz * Fpwm = 400.64 Hz (Requested : 400 Hz) * Resolution is 10 bits * Prescaler is 16 * Ensure that your PWM pin is configured as digital output * see more details on http://www.micro-examples.com/ * this source code is provided 'as this', * use it at your own risks */ PR2 = 0b10011011 ; T2CON = 0b00000111 ; CCPR1L = 0b01001101 ; CCP1CON = 0b00111100 the calculator uses advanced javascript functions, I tried with the latest release of IE, Opera and Firefox. Is your navigator up to date ? Thanks, Bruno http://www.micro-examples.com/public/microex-navig/doc/097-pwm-calculator.html
On Thu, 4 May 2006 12:11:15 +0200, the renowned "BrunoG"
<noreply@micro-examples.com> wrote:

>Hi, > >I wrote a PWM calculator and code generator : > >http://www.micro-examples.com/public/microex-navig/doc/097-pwm-calculator.html > >This may help anyone fighting with PIC PWM registers calculations... > >Questions & comments are welcome > >Bruno
Tr&#4294967295;s bon. Best regards, Spehro Pefhany -- "it's the network..." "The Journey is the reward" speff@interlog.com Info for manufacturers: http://www.trexon.com Embedded software/hardware/analog Info for designers: http://www.speff.com
Hi Bruno,

<font color=#ffffff>

white text on white background doesn't look good
in the source code window....

greets,
Wolf

-- 
From-address is Spam trap
Use: wolfgang (dot) mahringer (at) sbg (dot) at

"Wolfgang Mahringer" <yeti201@gmx.at> a &#4294967295;crit dans le message de news: 
ixo6g.14$Tz6.582808@news.salzburg-online.at...
> Hi Bruno, > > <font color=#ffffff> > > white text on white background doesn't look good > in the source code window.... > > greets, > Wolf > > -- > From-address is Spam trap > Use: wolfgang (dot) mahringer (at) sbg (dot) at >
Hi Wolfgang, It seems that some browsers do not apply the black background color from the <table bg=#000000> tag correctly, so I removed it, and font tag too. the code is now printed black on a white background, and should be convenient for all users. Thanks ;-) Bruno http://www.micro-examples.com/public/microex-navig/doc/097-pwm-calculator.html
"Spehro Pefhany" <speffSNIP@interlogDOTyou.knowwhat> a &#4294967295;crit dans le message 
de news: rf4k52lgfqetnrm4kos9ef60fm7t0vs3hs@4ax.com...
> On Thu, 4 May 2006 12:11:15 +0200, the renowned "BrunoG" > <noreply@micro-examples.com> wrote: > >>Hi, >> >>I wrote a PWM calculator and code generator : >> >>http://www.micro-examples.com/public/microex-navig/doc/097-pwm-calculator.html >> >>This may help anyone fighting with PIC PWM registers calculations... >> >>Questions & comments are welcome >> >>Bruno > > Tr&#4294967295;s bon. > >
;-)) Thanks ! Bruno http://www.micro-examples.com/public/microex-navig/doc/097-pwm-calculator.html
BrunoG scrobe on the papyrus:

> "Wolfgang Mahringer" <yeti201@gmx.at> a icrit dans le message de > news: ixo6g.14$Tz6.582808@news.salzburg-online.at... > > Hi Bruno, > > > > <font color=#ffffff> > > > > white text on white background doesn't look good > > in the source code window.... > > > > greets, > > Wolf > > > > -- From-address is Spam trap > > Use: wolfgang (dot) mahringer (at) sbg (dot) at > > > > Hi Wolfgang, > > It seems that some browsers do not apply the black background color > from the <table bg=#000000> tag correctly, so I removed it, and font > tag too. > > the code is now printed black on a white background, and should be > convenient for all users. > > Thanks ;-) > > Bruno > http://www.micro-examples.com/public/microex-navig/doc/097-pwm-calcula > tor.html
I'm using Opera version 8.51 and I still don't see any code only a large table of values. Where should I be looking for the code listing? -- John B
"BrunoG" <noreply@micro-examples.com> wrote in message
news:4459d34d$0$19719$8fcfb975@news.wanadoo.fr...
> Hi, > > I wrote a PWM calculator and code generator : > >
http://www.micro-examples.com/public/microex-navig/doc/097-pwm-calculator.ht ml
> > This may help anyone fighting with PIC PWM registers calculations... > > Questions & comments are welcome > > Bruno
Looks good, thanks. Is there something similar for the USARTs, and other things requiring multiple register settings where it is so easy to make a mistake? Bob
"John B" <spamj_baraclough@blockerzetnet.co.uk> a &#4294967295;crit dans le message de 
news: 4bun2nF132te8U1@individual.net...
> BrunoG scrobe on the papyrus: > >> "Wolfgang Mahringer" <yeti201@gmx.at> a icrit dans le message de >> >> It seems that some browsers do not apply the black background color >> from the <table bg=#000000> tag correctly, so I removed it, and font >> tag too. >> >> the code is now printed black on a white background, and should be >> convenient for all users. >> >> Thanks ;-) >> >> Bruno >> http://www.micro-examples.com/public/microex-navig/doc/097-pwm-calcula >> tor.html > > I'm using Opera version 8.51 and I still don't see any code only a > large table of values. Where should I be looking for the code listing? > > -- > John B
Hi John, The code is after the table of values. When no PWM value is entered, all the solutions are displayed, and in this case not code is given I tried with Opera V8.54 and it works fine, try for example with Fosc = 4 Mhz and Fpwm = 1000 Hz with 50% duty cycle, if your browser shows the table you should also see the code. Thanks, Bruno http://www.micro-examples.com/public/microex-navig/doc/097-pwm-calculator.html