required delay before function execution!!
Hello,
Please refer the function mentioned below.
Code:
void ringAlarm(int8* ai)
{
int i,j;
static int16 time_delay=10000;
time_delay=time_delay-1;
for(i=0;i<8;i++)
{
if(ai[i]==1 && time_delay==0)
{
switch(i)
{
case 0:
output_high(pin_A0);
break;
case 1:
output_high(pin_A1);
break;
case 2:
output_high(pin_A2);
break;
case 3:
output_high(pin_A3);
break;
case 4:
output_high(pin_A4);
break;
case 5:
output_high(pin_A5);
break;
case 6:
output_high(pin_E0);
break;
case 7:
output_high(pin_E1);
break;
}//switch ends
}// if ends
}//for ends
}
a[i] gives alarm conditions.
My requirement is
1. Check a[i]==1 i.e checking condition
2. Wait for some delay
3. Again check for a[i]
4. And if a[i]==1 after delay then only execute the function
But i can not use delay function which halts execution of next code.
With the above mentioned code i am not getting expected result.
Please suggest what i need to do?
thanks,
paddy