I think our wires were crossed.... What is it you want the function to do....If the flow is like ths..
read ch_0..
process ch_0
if ch_0 is bigger than 800 then delay 6 seconds then return O_L_S (finished)
read ch_1..
process ch_1
if ch_1 is bigger than 1000 then return H_V (finished)
or return N_V (finished)
In either case if ch_0 is bigger than 800 then ch_1 is ignored.
Are you wanting to halt like this.
Code:
int ProcessMains(void)
{
int x = 600;
ch_0 = getchreading(0);
Process_ch_0(); // Do something with ch_0 o\p lod sence
if (ch_0>800) // lod 130 % Wait 6 min
{
while(x--)
{
Delay1000ms;
ch_0 = getchreading(0);
Process_ch_0(); // Do something with ch_0 o\p lod sence
if(ch_0 < 800) return abc;
}
return(OVER_LOD_SENCE);
}
ch_1 = getchreading(1); WHICH MEANS THIS NEVER IS.
Process_ch_1(); // Do something with ch_1 o\p volt
if (ch_1>1000)
return(HIGH_VOLTAGE);
if (ch_1<950)
return(NORMAL_VOLTAGE);
}
you'll need to keep acessing the ch_0 reading to check if it goes lower.