Author Topic: PWM  (Read 4892 times)

0 Members and 1 Guest are viewing this topic.

Offline AleyTopic starter

  • Beginner
  • *
  • Posts: 1
  • Helpful? 0
« on: May 13, 2006, 07:31:34 AM »

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.

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,674
  • Helpful? 171
    • Society of Robots
« Reply #1 on: May 14, 2006, 07:19:55 AM »
This is how you control motors:

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)

Chances are you have sample code to turn on/off an LED? Its exactly the same code, just the loop goes really really fast.

Offline Hal9000

  • Supreme Robot
  • *****
  • Posts: 338
  • Helpful? 0
"The truth is, you can't hide from the truth, cos the truth is all there is" - Handsome Boy Modeling School


Get Your Ad Here