DC Motor speed control

Discussion about projects that used PIC Microcontroller, Hardware Interface, Programming Algorithm and etc......

DC Motor speed control

Postby Kromuald13 » Thu Feb 10, 2011 3:53 pm

Hi Guys
I am romuald , and i am a beginner when it comes to microcontroller programing (c language ) .
i have downloaded some testing codes from cytron DIY projects [ namely DC brush motor ]. and i was able to go through almost everything except , the pulse frequency setting . How we set it , and how we can change it on our will .
here follows the codes.
//PWM frequecy set as 4.88KHz
PR2 = 0xFF; //PWM Period Setting
T2CON = 0b00000101; //Timer2 On, prescale 4

i am using a pic16f877a , with an oxillator of 20Mhz

thanx in advance .
Kromuald13
Novice
 
Posts: 26
Joined: Wed Feb 09, 2011 2:03 am

Re: DC Motor speed control

Postby robosang » Thu Feb 10, 2011 8:27 pm

Most of the thing come from datasheet, if I am not mistaken, in datasheet of that particular PIC, PWM chapter, there is a table show the relationship between PR2 and frequency or period. It has to do with the Timer 2 prescaler, hope this help. :mrgreen:
robosang
Expert
 
Posts: 1239
Joined: Wed Jun 10, 2009 5:37 pm

Re: DC Motor speed control

Postby Kromuald13 » Tue Apr 26, 2011 1:05 pm

robosang WROTE:Most of the thing come from datasheet, if I am not mistaken, in datasheet of that particular PIC, PWM chapter, there is a table show the relationship between PR2 and frequency or period. It has to do with the Timer 2 prescaler, hope this help. :mrgreen:



thx man , it was very helpful
Kromuald13
Novice
 
Posts: 26
Joined: Wed Feb 09, 2011 2:03 am


Return to PIC Microcontroller

Who is online

Users browsing this forum: No registered users and 3 guests

cron