erfan.khalilian69
Member level 4
- Joined
- Feb 7, 2011
- Messages
- 71
- Helped
- 3
- Reputation
- 6
- Reaction score
- 3
- Trophy points
- 1,288
- Location
- Kualalampur
- Activity points
- 1,916
Hi everyone, I have really stock with this part in my project.
I want to increase the speed of motor as the temperature increasing, therefore I've got idea to use different frequency for different temperature.
I know I have to use CCP1CON ,PR2, T2CON . after initializing the PWM I write: CCPR1L=0; to stop the pwm because I want to activate this pin while the temperature is higher than 30 degree. but while I write CCPR1L=0; the PWM is not generating pulse even while the temperature is higher than 27.
here is my code :
unsigned char speed=50;
CCP1CON = 0b00001100; //PWM Mode
PR2 = 0xFF; //PWM Period Setting//PWM frequecy set as 4.88KHz
T2CON = 0b00000101; //Timer2 On, prescale 4
CCPR1L=0;
else if (temperature>27)
{
CCPR1L=speed;
}
any suggestion?
thanks
I want to increase the speed of motor as the temperature increasing, therefore I've got idea to use different frequency for different temperature.
I know I have to use CCP1CON ,PR2, T2CON . after initializing the PWM I write: CCPR1L=0; to stop the pwm because I want to activate this pin while the temperature is higher than 30 degree. but while I write CCPR1L=0; the PWM is not generating pulse even while the temperature is higher than 27.
here is my code :
unsigned char speed=50;
CCP1CON = 0b00001100; //PWM Mode
PR2 = 0xFF; //PWM Period Setting//PWM frequecy set as 4.88KHz
T2CON = 0b00000101; //Timer2 On, prescale 4
CCPR1L=0;
else if (temperature>27)
{
CCPR1L=speed;
}
any suggestion?
thanks