Mithun_K_Das
Advanced Member level 3
- Joined
- Apr 24, 2010
- Messages
- 899
- Helped
- 24
- Reputation
- 48
- Reaction score
- 26
- Trophy points
- 1,318
- Location
- Dhaka, Bangladesh, Bangladesh
- Activity points
- 8,254
I was designing a sine wave inverter based on smps. other blocks are on, now I need to generate a pure sine wave output with pwm signal. I'm using PIC16F73. Can anyone help me in calculation to get 50Hz sine wave??? And also the filter designing part needs help.
my program is:
float teta;
unsigned char sample[15];
int i=0;
void main()
{
TRISC = 0x00;
PORTC = 0x00;
PWM1_Start();
PWM2_Start();
PWM1_Set_Duty(50000);
PWM2_Set_Duty(50000);
while(1)
{
for (i=0; i<15; i++)
{
teta = ( (float) i / 15 ) * 3.14159;
sample = (int) (255 * sin ( teta ));
PWM1_Set_Duty(sample);
}
for (i=0; i<15; i++)
{
teta = ( (float) i / 15 ) * 3.14159;
sample = (int) (255 * sin ( teta ));
PWM2_Set_Duty(sample);
}
}
}
my program is:
float teta;
unsigned char sample[15];
int i=0;
void main()
{
TRISC = 0x00;
PORTC = 0x00;
PWM1_Start();
PWM2_Start();
PWM1_Set_Duty(50000);
PWM2_Set_Duty(50000);
while(1)
{
for (i=0; i<15; i++)
{
teta = ( (float) i / 15 ) * 3.14159;
sample = (int) (255 * sin ( teta ));
PWM1_Set_Duty(sample);
}
for (i=0; i<15; i++)
{
teta = ( (float) i / 15 ) * 3.14159;
sample = (int) (255 * sin ( teta ));
PWM2_Set_Duty(sample);
}
}
}