Society of Robots - Robot Forum

Software => Software => Topic started by: Aley on May 13, 2006, 07:31:34 AM

Title: PWM
Post by: Aley on May 13, 2006, 07:31:34 AM
Hi

I was wondering if anyone could help me.Im using the 8051 microcontroller and programming it in C using keil compiler i was wonderin if anyone could tell me how to give PWM to my motors and something about timers and flags in C a sample code with details in it would be great.
Title: Re: PWM
Post by: Admin on May 14, 2006, 07:19:55 AM
This is how you control motors:
http://www.societyofrobots.com/schematics_h-bridgedes.shtml

If your motor is small enough, you can also get a motor driver IC. It does not require you to PWM it.

To PWM, all you do is this:

bring a digital port high
wait 1 milisecond (or whatever time)
bring a digital port low
wait 1 milisecond (or whatever time)
loop

Chances are you have sample code to turn on/off an LED? Its exactly the same code, just the loop goes really really fast.
Title: Re: PWM
Post by: vash on December 18, 2006, 12:03:24 AM
Hey dude,

hows you ?

What exactly is the application of your robo.

I'm into making of a demining robo and i feel we could help each other.

what say ?

if you think so do contact me on :  [email protected]

bye

ciyaa
Title: Re: PWM
Post by: Hal9000 on December 18, 2006, 03:09:52 AM
These are good books from my lecturer:

http://www.amazon.co.uk/Embedded-C-Michael-Pont/dp/020179523X/sr=1-2/qid=1166432625/ref=sr_1_2/026-8953806-4463640?ie=UTF8&s=books

http://www.amazon.co.uk/Patterns-Time-Triggered-Embedded-Systems-microcontrollers/dp/0201331381/ref=pd_bxgy_b_img_b/026-8953806-4463640

However, this is a better one:

http://www.amazon.co.uk/C-8051-Thomas-Schultz/dp/158961237X/sr=1-2/qid=1166432717/ref=sr_1_2/026-8953806-4463640?ie=UTF8&s=books

Also check http://www.8052.com/codelib.phtml

I generally tend to use the AT89S53 breed of 8051

PWM is also very simple, as outlined above.