Searching \ for ' [PIC] PWM in background' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/ios.htm?key=pwm
Search entire site for: 'PWM in background'.

No exact or substring matches. trying for part
PICList Thread
'[PICLIST] [PIC] PWM in background'
2002\07\10@035009 by Dave King

flavicon
face
Hi

I was rtfm'ing and read something about HPWM in PicBasic. It is a method to set
and forget the pwm output. Once its setup it runs in the background and you can
ignore it until it changes from what I understand.

The one pic it mentioned that this worked on was the 18C452. I was looking at
the spec sheet at it is far more chip than I need for my current project. The
problem is that I can't find any other pics that support this background
pwm or
hardware pwm. I'm not even sure what else to look for on microchip as a couple
of hours tonight resulted in zilch.

I need to produce three different pwm streams at the same time with a high and
low pwm rate on each. In the mid mcu ref it says since the ccp is based around
timer2 if you have more than one pwm stream they will have the same frequency
and period. First thing is if I have that interpreted correctly? I need 3
distinct pwm
outputs and this would not allow them to differ?

I also remember someone posting about something similar a year or so ago and
the suggestion was to just out put binary strings instead of actual pwm.
This might
work too as my timing isn't terribly critical.

Anyone have any suggestions on where to look for more info? I'm reading
everything
I can find but nothing is making sense so far.

Dazed and confused ;-]

Dave








The only thing that helps me maintain my slender grip on reality is the
friendship I share with my collection of singing potatoes

\|/ ____ \|/
~@-/ oO \-@~
  /_( \__/ )_\
  \__U_/

--
http://www.piclist.com hint: To leave the PICList
spam_OUTpiclist-unsubscribe-requestTakeThisOuTspammitvma.mit.edu


2002\07\10@105240 by John Dammeyer

flavicon
face
Hi Dave,

Frequency and Period are the same thing (just one is an inverse) but you
know that.  I think what you are trying to say is that the PWM frequency
into the two CCP modules is the same;  the manual says they have the
same frequency and update rate.

What you can do is vary the on/off ratio independently. You set up the
PWM frequency with the Timer Prescaler and the PR2 value.  Then you
control the Duty Cycle (The time the bit is on) with the CCPRxL and
CCPxCON<5:4> bits.

Table 8-3 has a set of values for the Frequency from 1.22KHz to 208.3KHz
with a 20MHz CPU clock.  You can then fill the CCPRxL register with
0..255 and leave CCPxCON(5:4> 0 to have 256 possible PWM widths.

Cheers,

John





Wireless CAN with the CANRF module.
www.autoartisans.com/documents/canrf_prod_announcement.pdf
Automation Artisans Inc.
Ph. 1 250 544 4950


> {Original Message removed}

2002\07\10@125220 by David Minkler

flavicon
face
Dave,

I know this is heresy but if you really need three completely
independent PWM outputs at "high" speed, take a look at Cypress PSOC
micros.

Regards,
Dave


Dave King wrote:
{Quote hidden}

--
http://www.piclist.com hint: To leave the PICList
piclist-unsubscribe-requestspamKILLspammitvma.mit.edu


2002\07\10@131651 by D. Jay Newman

flavicon
face
An even better cheat is just to forget about the built-in PWM and
do it via interrupts or timing loops.

For example, I'm doing 8 channels of PWM. The each share the same period
(8 ms), but each can have a different cycle length (0-8 ms). I'm still
working on the prototype because I'm waiting for either my new
programmer or my new PICs (my programmer doesn't do 28 pin PICs!). But
my initial experiments worked fine.

All of this is for a SimmStick replacement for the Lego RCX (Mindstorms
computer). I'm using a Systronix JStamp for the processor, but I still
need motor and sensor drivers that work with the lego stuff.

I can post the code/schematics here when I finally get the darn thing
working (I'm hoping by Monday).

Of course, I still need to do the SPI communication, but I *think* I have
enough examples to figure this out.

{Quote hidden}

--
D. Jay Newman                      !  All:  There's nothing we can't face...
jayspamspam_OUTsprucegrove.com                !  Anya: Except for bunnies...
http://www.sprucegrove.com/~jay/   !    -- Buffy, the Musical

--
http://www.piclist.com hint: To leave the PICList
@spam@piclist-unsubscribe-requestKILLspamspammitvma.mit.edu


2002\07\10@144009 by Dave King

flavicon
face
At 09:57 AM 10/07/02 -0700, you wrote:
>Dave,
>
>I know this is heresy but if you really need three completely
>independent PWM outputs at "high" speed, take a look at Cypress PSOC
>micros.
>
>Regards,
>Dave

Isn't this a hangin offense on this list?? ;-] Looks like a nice wee beasty,
I'll have to look at these a bit closer. Free samples, serial programming,
free development tools.....

This means given my luck I wouldn't be able to actually buy any
here. We just were told about electricity here a week or so ago ;-]
(Future has them in stock at about $7 each.)

The pwm I need isn't high speed. The only concern is the 3 separate
pwm streams that would have to run continuously for a few hours
at a time.

Thanks

Dave

--
http://www.piclist.com hint: To leave the PICList
KILLspampiclist-unsubscribe-requestKILLspamspammitvma.mit.edu


2002\07\10@152437 by Francisco Ares

flavicon
face
I am using PIC17C756A, and it has three PWM hardware modules with 10 bit
resoltion at 32.2kHz with a 32MHz clock (and also several other nifty
hardware features, including analog inputs also 10 bit resolution, 2
USARTs, I2C, many I/O lines,...).

Hope this helps.
Francisco

Dave King wrote:

{Quote hidden}

--
http://www.piclist.com hint: To leave the PICList
spamBeGonepiclist-unsubscribe-requestspamBeGonespammitvma.mit.edu


2002\07\10@173347 by Andrew Errington

flavicon
face
Hi,

Have you read the PWM examples on Scott Dattalo's pages?

http://www.dattalo.com

These are software examples, and therefore *you* have to carefully
maintain the timebase.  I have played with the 256-level one, and it
works quite well on a 12C508.  I have incorporated an optical
interruptor to measure speed and to vary PWM to maintain the output
speed.  You have to be a bit careful and count the instructions to fit
the gaps that Scott has left, but I have now added 300bd RS232 comms
(but no command interpreter yet...).

In general there is little point in all this, however, the '508 is
*cheap* and it's so cute you just have to write code and make it do
things.

Andy

--
http://www.piclist.com hint: To leave the PICList
TakeThisOuTpiclist-unsubscribe-requestEraseMEspamspam_OUTmitvma.mit.edu


2002\07\10@194047 by David Minkler

flavicon
face
(/hang head beg for mercy)

Uhh yeah.  Didn't notice the .ca in your return.  We're a few miles from
Cypress Central and their FAE was developing his "developer's course".
I don't know why but I was the only one to show up so I got lots of
individual attention.  On the down side, the instruction timing is more
what you'd expect out of a CISC machine so it's (a little) tougher to
calculate path times through your code.  Given the fact that you have
dedicated hardware to do the timing however ...

(raise head/)
Regards,
Dave

Dave King wrote:
{Quote hidden}

--
http://www.piclist.com hint: To leave the PICList
RemoveMEpiclist-unsubscribe-requestspamTakeThisOuTmitvma.mit.edu


2002\07\10@195334 by Dave King

flavicon
face
Hi Andy

>Have you read the PWM examples on Scott Dattalo's pages?
>http://www.dattalo.com

I have now ;-] A few examples on the pwm and one section
on up to 8 pwm streams. Looks good.
However the bit of text at the first page.....
"If the pic code gave you a headache, this will give you a migraine"
Makes me nervous ;-]


Thanks!

Dave

--
http://www.piclist.com hint: To leave the PICList
piclist-unsubscribe-requestEraseMEspam.....mitvma.mit.edu


2002\07\10@202329 by Scott Dattalo

face
flavicon
face
On Wed, 10 Jul 2002, Dave King wrote:

> Hi Andy
>
> >Have you read the PWM examples on Scott Dattalo's pages?
> >http://www.dattalo.com
>
> I have now ;-] A few examples on the pwm and one section
> on up to 8 pwm streams. Looks good.
> However the bit of text at the first page.....
> "If the pic code gave you a headache, this will give you a migraine"
> Makes me nervous ;-]

Oh that's just the theory stuff. But the 256 level software PWM routine is
the most obscure software I've ever seen written for a PIC. It may require
a bottle or two of aspirin to wrap your head around it!

There are also a few other software ways to generate PWM's. One that's
fairly straight forward uses phase accumulators. Essentially, you
repeatedly add the "duty cycle" to a variable and every time it rolls over
you toggle the output

  movf   dc0,w
  addwf  pa0,f
  rrf    rollover,f

...
7 more times


  xorwf  PORTB,f

At 25 cycles, it's slightly more than the 23 posted on the web page.
However, if you're just generating analog voltages (i.e. filtering this
with a low pass filter), then this will *maximize* the frequency.

Scott

--
http://www.piclist.com hint: To leave the PICList
EraseMEpiclist-unsubscribe-requestspammitvma.mit.edu


2002\07\10@212146 by Michael Rigby-Jones

flavicon
face
{Quote hidden}

The PIC's that include the CCP (Compare Capture Peripheral) will aloow
either one or two hardware PWM outputs.  In the case of two outputs, both
have the same timebase, derived from Timer 2 as you have discovered, which
means the PWM frequency will be the same for both.  The PWM duty cycle is of
course independantly adjustable for each output.

To get a third output you will need to resort to a software PWM which can
either be performed in a loop in the main code, or via a timer interrupt
(easier IMO).

Regards

Mike

--
http://www.piclist.com hint: To leave the PICList
RemoveMEpiclist-unsubscribe-requestTakeThisOuTspamspammitvma.mit.edu


More... (looser matching)
- Last day of these posts
- In 2002 , 2003 only
- Today
- New search...