Searching \ for '[pic]: 16F628 and PWM using PBP' 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: '16F628 and PWM using PBP'.

Exact match. Not showing close matches.
PICList Thread
'[pic]: 16F628 and PWM using PBP'
2003\02\13@183915 by Daniel Gliebe

picon face
I've just switched over from using the old PIC16F84 to the PIC16F628.  I use PicBasic Pro for all my programs.  I just want to know if my thinking is correct...  Since the 16F628 has hardware PWM, is it possible for me to write a program in Basic where I can output PWM pulses on several pins simultaneously while at the same time listening for serial data on another pin?  i.e. Can I set the output pins and let the hardware maintain the PWM pulses indefinitely without having to do any looping?
Thanks for any advice.

  -Dan

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2003\02\13@184525 by Sid Weaver

picon face
In a message dated 02/13/2003 18:40:01 Eastern Standard Time,
spam_OUTdans_pic_stuffTakeThisOuTspamHOTMAIL.COM writes:


> i.e. Can I set the output pins and let the hardware maintain the PWM pulses
> indefinitely without having to do any looping?
> Thanks for any advice.
>
>

I'm not familiar with the 628, but if it has a CCP1 and a CCP2 module you can
output PWM continuously in the background while the program does something
else.  You will have to use the HWPM command - make sure it is structured
correctly, pin, duty cycle, frequency.  CCP1 and CCP2 modules are usually on
C.2 and C.3

Sid

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2003\02\13@184942 by Sid Weaver

picon face
For Dan

Just looked at the 628 data sheet.  I see that CCP1 module is on B.3 so you
will only be able to send one pwm signal continuously.

Sid

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2003\02\13@185755 by michael brown

picon face
From: "Daniel Gliebe"

I've just switched over from using the old PIC16F84 to the PIC16F628.  I
use PicBasic Pro for all my programs.
I just want to know if my thinking is correct...  Since the 16F628 has
hardware PWM, is it possible for me to write a program in Basic where I
can output PWM pulses on several pins simultaneously while at the same
time listening for serial data on another pin?
i.e. Can I set the output pins and let the hardware maintain the PWM
pulses indefinitely without having to do any looping?
Thanks for any advice.

Dan,

Yes.  The 628 PWM output is completely asynchronous to your code.  Once
you set it up and turn it on, it continues on automatically.  If you
wish to change the "duty cycle", all you have to do is write to PR2 and
it will take effect at the beginning of the next  "period".

michael brown

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2003\02\13@193458 by michael brown
picon face
> I've just switched over from using the old PIC16F84 to the PIC16F628.
I
> use PicBasic Pro for all my programs.
> I just want to know if my thinking is correct...  Since the 16F628 has
> hardware PWM, is it possible for me to write a program in Basic where
I
> can output PWM pulses on several pins simultaneously while at the same
> time listening for serial data on another pin?
> i.e. Can I set the output pins and let the hardware maintain the PWM
> pulses indefinitely without having to do any looping?
> Thanks for any advice.
>
> Dan,
>
> Yes.  The 628 PWM output is completely asynchronous to your code.
Once
> you set it up and turn it on, it continues on automatically.  If you
> wish to change the "duty cycle", all you have to do is write to PR2
and
> it will take effect at the beginning of the next  "period".
>
> michael brown

BTW, the bummer is that the PWM mode of the capture/compare module uses
TMR2, whereas the other modes use TMR1.  This may or may not bother you.
OTOH, it really torques me off, because you can't use the postscaler to
stretch the "period" out.  I have some example code if you want it, but
the datasheet is fairly clear on the register setup.  I tinkered with an
R/C servo motor using the hardware PWM.  Even though I was using a 4Mhz
crystal, it still made the period way shorter than I wanted.  The
minimum period length (4Mhz) is around 5ms.  I wanted a 20ms period
length for the servo, but it still worked fine with my particular servo
motor.  YMMV

michael

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2003\02\13@221240 by Wouter van Ooijen

face picon face
>  Since the
> 16F628 has hardware PWM, is it possible for me to write a
> program in Basic where I can output PWM pulses on several
> pins simultaneously while at the same time listening for
> serial data on another pin?
> i.e. Can I set the output pins and let the hardware maintain
> the PWM pulses indefinitely without having to do any looping?

Yes, except that the plural must be singular: there is only one PWM
channel.

Wouter van Ooijen

-- -------------------------------------------
Van Ooijen Technische Informatica: http://www.voti.nl
consultancy, development, PICmicro products

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2003\02\14@074530 by Olin Lathrop

face picon face
> Yes.  The 628 PWM output is completely asynchronous to your code.  Once
> you set it up and turn it on, it continues on automatically.  If you
> wish to change the "duty cycle", all you have to do is write to PR2 and
> it will take effect at the beginning of the next  "period".

No, PR2 and the timer 2 prescaler control the period.  The duty cycle is
controlled by CCPR1L and bit 5..4 of CCP1CON.


*****************************************************************
Embed Inc, embedded system specialists in Littleton Massachusetts
(978) 742-9014, http://www.embedinc.com

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email .....listservKILLspamspam@spam@mitvma.mit.edu with SET PICList DIGEST in the body

2003\02\14@120934 by michael brown

picon face
> > Yes.  The 628 PWM output is completely asynchronous to your code.
Once
> > you set it up and turn it on, it continues on automatically.  If you
> > wish to change the "duty cycle", all you have to do is write to PR2
and
> > it will take effect at the beginning of the next  "period".
>
> No, PR2 and the timer 2 prescaler control the period.  The duty cycle
is
> controlled by CCPR1L and bit 5..4 of CCP1CON.

Of course you are right as usual Olin.  ;-)  I don't know what I was
thinking.  And I just spent some time messing with this too.  I guess
that's why they call it the "period register".  <:-)  I suppose this
1-wire stuff has my brain scrambled right now.

michael brown

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email listservspamKILLspammitvma.mit.edu with SET PICList DIGEST in the body

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