Current Sensor

float current(uint8_t phase,uint8_t channel)
{
  float current;
  uint16_t ADC_Value;
  ADC_Value=read_adc(channel);
  if(phase==AC_Current)
	{
		if(ADC_Value>=512)
			{
			 current=(ADC_Value-512)*(5/(ADC_Scale*sinsitivity)); //VCC=5V
			}
	}
     else if(phase==DC_Current)
	{
		current=(ADC_Value-512)*(5/(ADC_Scale*sinsitivity)); //VCC=5V
	}
	
 return current;
}
  #include<avr/io.h>
  #include<stdio.h>
  #include<avr/interrupt.h>
  #include"adc.h"
  #include"lcd.h"
float VA=1,Amp_ac,Amp_dc,volage=220;
char str[20];
int main(void)
  {
   LCD_INIT();
   adc_init();
   LCD_Clear();
   timer_ISR();
   while(1)
    {
      sprintf(str,"AC Current=%.2fA",Amp_ac);
      LCD_write_string(1,1,str);
      sprintf(str,"DC Current=%.2fA",Amp_dc);
      LCD_write_string(1,2,str);
      _delay_ms(1000);
    }
  return 0;
}
ISR(TIMER0_OVF_vect)
{
	Amp_ac=current(1,0); //AC Current(1) with channel 0
	Amp_dc=current(2,1); //DC Current(2) with channel 1
	
}