Temp must be the differential from setpoint - reading. So this could be a solution:


Allarm_Validation:
For a0 = 1 to 500
Pause 1
Next a0
If temp <= 2 then
time_count = time_count + 1
If time_count >= 10 then gosub allarm_label
Count = 0
Flag_alrm = 1
Else
time_count = 0
Flag_alrm = 0
ENDIF

Cheers

Al.