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

Exact match. Not showing close matches.
PICList Thread
'[PIC]dsPIC PWM Duty Cycle'
2009\05\16@140745 by Nathan House

picon face
Good afternoon,

I'm trying to get the PWM module on my dsPIC30F4011 working so that I can
drive a hobby servo (which takes a 1-2ms pulse), but am confused on how to
calculate the duty cycle.

Fosc = 10x10^6 (10MHz)
Fcy  = 2.5x10^6 (2.5MHz)
Tcy   = 4x10^-7  (400ns)
Fpwm = 55.555 (1/18ms)

PTPER = 44999

I assume I'm supposed to use the "Duty cycle for Free Running Mode" equation
15-4 in 70062E.pdf:



But I don't know how to use this equation, since I don't know what PDCx or
DT is.

Any help would be appreciated, thanks!

Nathan

2009\05\16@205114 by Nathan House

picon face
Did my message with the same name as this one get "out"?

I ask because I just searched the piclist.com website with the exact title
of the message and I didn't see it as a result.

Just looking for some confirmation that it did get posted.

Thanks!

Nathan

2009\05\16@210836 by Bob Blick

face
flavicon
face
Yes, at 11:07 AM

Nathan House wrote:
> Did my message with the same name as this one get "out"?
>
> I ask because I just searched the piclist.com website with the exact title
> of the message and I didn't see it as a result.
>
> Just looking for some confirmation that it did get posted.
>
> Thanks!
>
> Nathan

2009\05\17@040723 by Russell McMahon

face
flavicon
face
> Yes, at 11:07 AM

Or at 6:07am here.
ie time zone may affect your shown time.

R

2009\05\17@222724 by Nathan House

picon face
I'm really confused by this. The family reference
manual<http://ww1.microchip.com/downloads/en/DeviceDoc/70062E.pdf>says:



I'm assuming that "DT" stands for dead time; and since I'm not using the
dead time generator, the equation becomes:



Is duty cycle in percent? To calculate the value for the "PDCx" register
(which controls the pin's duty cycle) for say, 100%, do I put the 100% where
the "Duty cycle for Free Running Mode" text is? Thus making the equation:


?

Inserting my PTPER value, and solving for PDCx?:

1)


2)


3)


4)



That can't be right!

I'm so confused...

2009\05\20@101428 by Nathan House

picon face
Does anyone know how to calculate duty cycle for a dsPIC30F?

2009\05\20@103432 by olin piclist

face picon face
Nathan House wrote:
> Does anyone know how to calculate duty cycle for a dsPIC30F?

Of course.


********************************************************************
Embed Inc, Littleton Massachusetts, http://www.embedinc.com/products
(978) 742-9014.  Gold level PIC consultants since 2000.

2009\05\20@134814 by VICENTE COLOMAR PRATS

picon face
Basicaly is the same as lower-rage micros:

* First you have to set the Period. That is the same as establishing the
frequency. To do that, you have to set post-scaler and pre-scaler, then
PTPER register. With those numbers your micro will count, and depending on
the micro frequency you will have a determined pwm frequency.
* To set duty cycle you have to write PDCx register (depending in wich of 3
generators you use). This value depends on previous PTPER, so, if you use
PDC1=PTPER you will have 100% PWM, if you use PDC1=PTPER/2 you will have 50%
PWM and so on...

That's very esquematic, you have some more registers wich need configuration
before to start pwm. Read chapter 15 on the 30F4011 datasheet.

Good look, I'm also starting with same micro.

2009\05\21@115316 by Nathan House

picon face
OK. Someone could have pointed out that my problems came from a stupid,
simple little math error ;-)

I think it's working now.

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