problem in generating the pwm output

Status
Not open for further replies.

sangeetha sangu

Newbie level 4
Joined
Mar 4, 2013
Messages
6
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Visit site
Activity points
1,355
hi, i have posted the code ,please can anyone tell me what is the problem in generating the pwm output

int freq,rpm,prpm,k;

interrupt service routine
{
k++
portb=0x02;
}
input capture service routine
int crpm=tcnt1;
freq=tcnt1;
if(tov1)
{
rpm=((tov1*65535)/freq)+((crpm-prpm)/freq);
}
else
{
rpm=((crpm-prpm)/freq);
}
prpm=crpm;
k=0;
}
voidmain(void)
while(1)
{
int i,j;
int ton=0;
for(i=0;i<100;i++)
{
for(j=0;j<=freq;j++)
{
for(ton-0;ton<100;ton++)
{
ocrial=ton/rpm;
}
}
}
}
}
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…