Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Robotics Chat


Robotics Chat Specific to discussions about robots and the making of.

Reply
 
Thread Tools Display Modes
Old 21st March 2008, 07:51 PM   (permalink)
Default PWM signal problem

I need to use PIC16F877A to generate a PWM signal to control my motor driver--MD22(http://www.robot-electronics.co.uk/htm/md22tech.htm), the RC servo mode of MD22 need a PWM signal which has PWM period of 20ms and duty cycle range from 1ms to 2ms.
I look for the frequency problem online regarding PIC16F877A, but it seems that the lowest PWM frequency I can get is about 488Hz.
How can I generate the PWM signal in this case?

I need some help...
thank you
iznalgnaij is offline   Reply With Quote
Old 21st March 2008, 09:45 PM   (permalink)
Default

It's usual to do it completely in software, even a BASIC STAMP can do it.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is online now   Reply With Quote
Old 24th March 2008, 05:24 AM   (permalink)
Default

You can make a timer interrupt that goes as long as you want and base some code that manually turns a pin high and low off of that to make slow PWM.
dknguyen is offline   Reply With Quote
Old 25th March 2008, 08:50 AM   (permalink)
Default

Quote:
Originally Posted by dknguyen
You can make a timer interrupt that goes as long as you want and base some code that manually turns a pin high and low off of that to make slow PWM.
I am a bird to this PIC programming, is there any example code which show how to write this kind of interrupt?
iznalgnaij is offline   Reply With Quote
Old 25th March 2008, 12:40 PM   (permalink)
Default

iznalgnaij:

Just use a slower xtal oscillator (32.768 kHz would work), or maybe an RC osc; read up on the different osc types (this is all explained in the PIC16F877A data sheet). The duty cycle pulse is no problem no matter what xtal you use. The Period=P is:

P=[(PR2+1)4(Tosc)(PSV)] where PSV=prescale value

Ex. If use a 32.768 kHz xtal, with PSV=1 then PR2+1=163.84 ->164
Period(actual) = 20.0195 mS, 0.002 % difference from 20 mS

Last edited by second286; 25th March 2008 at 09:51 PM.
second286 is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Latest
The Oscilloscope ElectroMaster Electronic Theory 12 3rd February 2008 01:45 PM
Using Oscilloscopes mechie Electronic Theory 9 29th November 2007 09:48 PM
RF SIGNAL problem stanleymyc Electronic Projects Design/Ideas/Reviews 2 1st June 2004 05:39 PM
Big thermocouple ADC problem Oznog General Electronics Chat 9 4th May 2004 08:42 PM
Building a signal mixer (for music primary) thec Electronic Projects Design/Ideas/Reviews 4 3rd October 2002 05:07 PM



All times are GMT. The time now is 10:31 AM.


Electronic Circuits  |  Electronics Wiki
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.