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.

pic16f628 simplest pwm?

Status
Not open for further replies.

gastonanthony

New Member
I'm having a hard time understanding the tutorial of nigel for the pwm, maybe because of all the initializations(it's making me dizzy, :shock: Can someone please post a very simple code for a simple servo control using pwm module of the pic16f628?i only need a 20ms period for 2 waveforms, one with a 1ms on and 19ms off, and the other one is 2ms on and 18ms off, :?: :D thanks in advance :)
 
gastonanthony said:
I'm having a hard time understanding the tutorial of nigel for the pwm, maybe because of all the initializations(it's making me dizzy, :shock: Can someone please post a very simple code for a simple servo control using pwm module of the pic16f628?i only need a 20ms period for 2 waveforms, one with a 1ms on and 19ms off, and the other one is 2ms on and 18ms off, :?: :D thanks in advance :)

The hardware PWM module isn't really suitable for servo control, it doesn't give enough resolution (as you can only use a small part of its range - 5%).
 
Nigel Goodwin said:
The hardware PWM module isn't really suitable for servo control, it doesn't give enough resolution (as you can only use a small part of its range - 5%).

True. But the OP specifically said he needs only two waveforms and nothing in between. It might be possible but I have no experience with PWM coding.

To the original poster, if the initialization codes of PIC make you dizzy, don't be surprised. We all felt the same when we first dip out feet into the PIC pool, it will soon pass because either one floats or drown. :D
 
ok, so I think I'll just use the normal output pins to be able to have better resolution. I'll just use the interrupt pins to control the microcontrollers using a desktop for my robotic project.thanks:D :D
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top