Any body know how to add Hysteresis to an ADC input.
This my over temp loop.
I think I still have issues.
Loop is still breaking. I don't think break is applied correctly.
I like to know how I can add hysteresis to ADC (2) value.
I like remain in the loop until say ADC is below 200.
The above code works but ADC is set at 1000.
The part " if(temp<=200);" does not work.
Rich (BB code):
void Tempcheck(){
while(1){
Temp = ADC_Read(2); //Read ADC temperature.
if(temp>=1000){ //This value determines the overtemp-
Vout_Rly = 0; // and if overtemp program remain-
Stby_Rly = 0; // loop. Switches off all Relay out-
Lcd_Out(1,1,txt4); // until PSU cools down. Flashes -
Lcd_Out(2,1,txt5); // warning msg in this loop
Delay_ms(500);
Lcd_Out(1,1," ");
Delay_ms(250);
Lcd_Out(1,1,txt4);
if(temp<=200);
break;
}
Delay_ms(500);
Lcd_Cmd(_LCD_CLEAR);
Delay_ms(100);
Stby_Rly = 1;
break;
}
}
I think I still have issues.
Loop is still breaking. I don't think break is applied correctly.
I like to know how I can add hysteresis to ADC (2) value.
I like remain in the loop until say ADC is below 200.
The above code works but ADC is set at 1000.
The part " if(temp<=200);" does not work.