Sub DS1320timer_Tick()
Dim currenttime As DSTime
currenttime = DS1302.CurrentTime
Years = currenttime.years
Months = currenttime.Months
DayOfMonth = currenttime.DayOfMonth
Hours = currenttime.Hours
Minutes = currenttime.Minutes
Seconds = currenttime.Seconds
DayOfWeek = currenttime.DayOfWeek
TimeTicks = TimeTicks + 1
MinutesSerial = GetMinutsSerialNumber(Years,Months,DayOfMonth,Hours,Minutes)
Blink = Not(Blink) 'toggle blink status, all blinking leds will blink at same time
If TimeTicks > (TimeTicksLast + 5) Then
For m = 0 To 13
BufferLast(m) = 0 'reset comparison array
Next
EnableRFID(True)
End If
'If readRFIDbusy = False Or KeypadBusy = False Or CommandBusy = False Then ' no reading, start count
If ReadRFIDbusy = False Or CommandBusy = False Then ' no reading, start count
LCDdisplayTicks = LCDdisplayTicks + 1
If LCDdisplayTicks >= SYS_LCD_TIMEOUT Then
Sleep = True
SetBacklightLevel(0x00,False)
LCD.Clear
LCD.DisplayOn = False
LCD.CursorOn =False
LCD.Blink = False
IndicateAll (False,False,False)
'ScreenType = SCREEN_TYPE_MAIN '******************* change this in the future, but now we return to main screen if timeout occure at any place in code
StandbyPowerLED.DigitalWrite(Blink) 'blink standby led
End If
End If
If RFIDmode <> RFID_MODE_LOGGER Then
OKReadyLED.DigitalWrite(Blink)
End If
If ScreenType = SCREEN_TYPE_MAIN Then 'update date time on main screen only
PutString(0,0,DayOfWeekArr(DayOfWeek - 1),False)
'PutString(0,0,DayOfWeekArr(DayOfWeek-1),False)
PutString (4,0,NumberFormat(Years,4,0),False)
PutString (8,0,"-",False)
PutString (9,0,NumberFormat(Months,2,0),False)
PutString (11,0,"-",False)
PutString (12,0,NumberFormat(DayOfMonth,2,0),False)
PutString (5,1,NumberFormat(Hours,2,0),False)
PutString (7,1,":",False)
PutString (8,1,NumberFormat(Minutes,2,0),False)
PutString (10,1,":",False)
PutString (11,1,NumberFormat(Seconds,2,0),False)
PutString (0,3,SigningArray(SigningMode-1),False)
PutString (4,3,ReasonCodeArray(ReasonCode-1),False)
PutString (8,3,LoadTypeArray(LoadType-1),False)
PutString (11,3,RFIDmodeArr(RFIDmode-1),False)
End If
End Sub