Software > Software

PWM

(1/1)

Aley:
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.

Admin:
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.

vash:
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 :  pisaat@rediffmail.com

bye

ciyaa

Hal9000:
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.

Navigation

[0] Message Index

Go to full version