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
Having noise in clock generated using TMR0 Interrupt :MCU:IC16F73.
What may be the reason of this noise?
This is the main program for the oscillation.
What may be the reason of this noise?
Code:
void interrupt()
{
os_cnt++;
while(os_cnt<=5+feedback)
{
RC6_bit = 0;
RC7_bit = 0;
break;
}
while(os_cnt>=5+feedback && os_cnt<=85-feedback)
{
RC6_bit = 1;
RC7_bit = 0;
break;
}
while(os_cnt>=85-feedback && os_cnt<=90+feedback)
{
RC6_bit = 0;
RC7_bit = 0;
break;
}
while(os_cnt>=90+feedback && os_cnt<=160-feedback)
{
RC6_bit = 0;
RC7_bit = 1;
break;
}
while(os_cnt>=160-feedback)
{
RC6_bit = 0;
RC7_bit = 0;
break;
}
while(os_cnt==161)
{
os_cnt=0;
break;
}
TMR0 = 200; // Timer TMR0 is returned its initial value
INTCON = 0x20; // Bit T0IE is set, bit T0IF is cleared
}
////////////////////
///////////////////
void main()
{
..................
............
while(1)
{
ADCON0=0b00000001;
adc_rd0 = ADC_Read(0);
avg_pwm = adc_rd0;
while(avg_pwm>80)
{
if(feedback<50)
{
feedback++;
//Delay_ms(20);
}
else
{
feedback = feedback;
}
break;
}
while(avg_pwm<=80)
{
if(feedback>1)
{
feedback--;
//Delay_ms(20);
}
else
{
feedback = feedback;
}
break;
}
}
}
This is the main program for the oscillation.