int t=0; //time counter
float i;
float data1;
char txt[20];
// ***********************************************
// ********** Interrupt Service Routine **********
void interrupt()
{
if(INTCON.T0IF)
{
t++; //for evry inettruption occure we increment t
TMR0=150; //the value to start the tmr0 if is spesified in the main program
INTCON.T0IF=0;
}
}
// **********************************
// ********** Main Routine **********
void main()
{
Option_Reg=0b10010000;
INTCON=0b10100000;
TRISD=0;
PORTD=0;
TMR0=150;
i=0;
data1=0;
lcd_init();
ADC_Init();
for(;;)
{
if(t==1)
{
i=ADC_Read(0);
data1=i/(1023/5);
}
}
}