thannara123
Advanced Member level 5
Hello ,
I am making an automatic stabilzer by using atmega8 . I am taking AC input and output directly (with very low gain) and connected to ADC and the part of mesuaring and relay section works correctely [not finall].
But when i varies the voltage speedly the atmega8 is crashes
FOR MORE plesas see the the working video .
what will be the problem .
I am using float to int by typecasting
PART OF THE CODE
REFERANCE : https://www.edaboard.com/showthread.php?373986-Atmega8-voltmeter-hang-up-somewhere
I am making an automatic stabilzer by using atmega8 . I am taking AC input and output directly (with very low gain) and connected to ADC and the part of mesuaring and relay section works correctely [not finall].
But when i varies the voltage speedly the atmega8 is crashes
FOR MORE plesas see the the working video .
what will be the problem .
I am using float to int by typecasting
PART OF THE CODE
Code:
data_value(); input_volt = volt_read_disply(0);
DELAY_ms(100);
volt =(int)input_volt; // double to int casting
LCD_GoToXY(0,7);
LCD_DisplayNumber(10,volt,3);
output_volt = volt_read_disply(1);
DELAY_ms(100);
LCD_GoToXY(1,7);
LCD_DisplayNumber(10,output_volt,3);
Code:
double volt_read_disply(int c){ int i,adc_value[40]={0}; int temp =0;
adc_init();
for(i=0; i<40;i++) // samples taking from 41 times 9.4milli second taken about on complte half cycle
{ DELAY_ms(5);
adc_value[i] = read_adc(c); // reading voltage
}
temp = adc_value[0];
for(i=0; i<40; i++)
{
if(temp<adc_value[i])
temp=adc_value[i];
}
return (double)(temp-307)*0.660; // int to double casting
REFERANCE : https://www.edaboard.com/showthread.php?373986-Atmega8-voltmeter-hang-up-somewhere
Last edited: