NitinPK
Newbie level 2
- Joined
- Apr 14, 2013
- Messages
- 2
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Activity points
- 1,309
PIC -CCS
SETUP_CCP1();
setup_power_pwm(PWM_CLOCK_DIV_4 | PWM_FREE_RUN | PWM_DEAD_CLOCK_DIV_4,1,10000,1000,0,1,0);
set_pwm1_duty(duty);
hello dears ...
can you elaborate ..further ... because i am also trying to do variable frequency and variable voltage for Single phase 220V motor Speed control, Using PIC16f877.
i am struggling to do this ..
Please help me ...
i need of Only pwm parts .. remaining i will take care ..
thanks
madhu.
Here is the files for generating sine wave with pwm in pic micro controller.. Change the program to generate different v/f...
https://www.edaboard.com/threads/297108/
#include<pic.h>
#define _XTAL_FREQ 20000000
int time_prd=255,tmp;
unsigned char PRESCL=4;
unsigned long freq;
pwm_periode(char pwm_prd,char prescl) //prescl 1/16/4 default 1
{
PR2=pwm_prd;
time_prd=pwm_prd;
if(prescl>4)
{
T2CKPS1=1; //PRESCLAR VALUE 1:16
T2CKPS0=1;
PRESCL=16;
}
else if(prescl>1)
{
T2CKPS1=0; //PRESCLAR VALUE 1:4
T2CKPS0=1;
PRESCL=4;
}
else
{
T2CKPS1=0; //PRESCLAR VALUE 1:1
T2CKPS0=0;
PRESCL=1;
}
TMR2ON=1;
}
void freq_disp()
{
float tmp1;
// PR2 = ( ( 1/pulse frequency in Hz ) / ( 1/clock speed x 4 x prescaler value ) ) - 1
//F= _XTAL_FREQ/(4*PRESCL*(1+PR2))
tmp1=4*PRESCL*(1+time_prd);
freq=_XTAL_FREQ/tmp1; //frequency
}
the complete source code is available from www.microchip.com
**broken link removed**
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?