Device = 18F2520 // Tells whitch chip im using
Clock =8 // tell the complier to base on a 8 Mhz clock for delays.
Config OSC = INTIO67 // sets OSC it onboard oscillator
#option LCD_DATA = PORTC.4
#option LCD_RS = PORTB.0
#option LCD_EN = PORTB.1
Include "intio8.bas" // set's the osscon to 8 Mhz
Include "LCD.bas"
Include "utils.bas"
Include "convert.bas"
Include"timer0"
Dim ds As Word
Dim min As Word
Dim sec As Word
Dim LED As PORTB.4
Event drytime()
sec = sec -1
min = min -1
If sec = 0 Then
sec = 59
EndIf
End Event
Interrupt ISR()
If Timer0.InterruptFlag =1 Then
Timer0.SInterrupt()
EndIf
End Interrupt
SetAllDigital()
Output(LED)
Timer0.Initialize(drytime)
Timer0.SetPrescaler(Timer0.PS256)
Timer0.EightBit = 0
Timer0.Preload = 55000
Timer0.LoadCount(Timer0.Preload) // **ADDED** to load count
Timer0.EnableInterrupt()
Timer0.Enabled()
Enable(ISR)
min = 420
sec = 59
While true
ds = min / 60 // to get the minutes
LCD.WriteAt (2,1, "time:" ,DecToStr(ds),":", DecToStr(sec))
If min = 0 Then // timed out
Toggle (LED) // led toggle
min = 420
EndIf
Wend