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, :?: 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.
 
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
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…