Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

HPWM. hard ware pwm module

Status
Not open for further replies.

TKS

New Member
Hi,

I wanted to use the Hardware pwm module in the pic 16F877a @ 20Mhz

Is it true that i cant reacht the frequency of 50 Hertz???

but a minimum of 250Hz

if its true wich electrical part could i use to edit that??

for example a devider of 5 soow i will clock the 16F877a to 250..etc..

hope you all can help a bit

TKS
 
TKS said:
Hi,

I wanted to use the Hardware pwm module in the pic 16F877a @ 20Mhz

Is it true that i cant reacht the frequency of 50 Hertz???

but a minimum of 250Hz

if its true wich electrical part could i use to edit that??

for example a devider of 5 soow i will clock the 16F877a to 250..etc..

Without checking the datasheet I can't be sure of the figures, but low frequency usage is obviously limited if you use a high clock frequency.

If it is 250Hz? (and I've no reason to doubt you!), dropping the clock crystal to 4MHz would drop the PWM down to 50Hz.

But 50Hz doesn't sound a very 'useful' PWM frequency, and would be fairly easy to do in software anyway.

What actually are you trying to do?.
 
ok

I need to control 3 servo's

But the servo's i need a continous pwm singal on the line,
if i don't do that they turn to start position...

and that's something i cant use.


i want to make a control chip for:
a electronic to hydraulic clutch pedal
a eletronic accelerator
a electronic gearbox
etc
etc

TKS
 
Re: ok

TKS said:
I need to control 3 servo's

But the servo's i need a continous pwm singal on the line,
if i don't do that they turn to start position...

The hardware PWM module isn't suitable for driving servos, but they are quite easy to do in software - the servos only require a 0.5-1.5mS pulse every 20mS or so - but only the 0.5-1.5mS is crucial, the 20mS can be 10mS?, 30mS?, it's not at all critical.
 
uhhh

just a number...

you said 5ms would work also (thats 4times 50Hz)

do you mean it isn't accurate the 50hz

or that it can be what you want..??

TKS
 
Re: uhhh

TKS said:
just a number...

you said 5ms would work also (thats 4times 50Hz)

Actually I said 10mS or 30mS, it's only the positive going pulse which matters - the space between pulses doesn't make any difference (within reason).

do you mean it isn't accurate the 50hz

or that it can be what you want..??

It can be what you want (again, within reason), it's the width of the positive pulse which sets the servo position, not the gaps in between them.

But again, the PWM module isn't much use for it!.
 
what meand that "again its not much use of it??"

will it work or not?

i think its the best way to do it that way because of the fact that you don't need to look at program time between the commands untherstand??

TKS
 
TKS said:
what meand that "again its not much use of it??"

will it work or not?

i think its the best way to do it that way because of the fact that you don't need to look at program time between the commands untherstand??

Yes, but you need one PWM module for each servo - most PIC's only have one or two. Then you can only get low resolution, 1mS change (0.5-1.5mS) with (as standard) a 20mS repetition rate - this only gives you about 50 different positions for the servo.
 
mhhh

mhhh
thats bad news..

if the load on the servo isn't high..

could i use a mosfet or transistor to switch it on/off before sending the pulses etc??

would that be a trick??

i use a compiler to make the software in fact how would you do it in asm???

this way??

start:

measure

pos servo

do other stuff (with in 20ms limit)

pos servo

do other stuff (with in 20ms limit)

goto start

regards
 
Re: mhhh

TKS said:
mhhh
thats bad news..

if the load on the servo isn't high..

could i use a mosfet or transistor to switch it on/off before sending the pulses etc??

would that be a trick??

Why would you want to?.

i use a compiler to make the software in fact how would you do it in asm???

this way??

start:

measure

pos servo

do other stuff (with in 20ms limit)

pos servo

do other stuff (with in 20ms limit)

goto start

regards

Yes, that's one way of doing it, or you could use timer interrupts to generate the servo pulses in the background.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top