Parallax, Inc. • BS2p “Plus Pack” (#45184) • 10/2001
Page 23
Su DATA " SUNDAY",0
Mo DATA " MONDAY",0
Tu DATA " TUESDAY",0
We DATA "WEDNESDAY",0
Th DATA " THURSDAY",0
Fr DATA " FRIDAY",0
Sa DATA " SATURDAY",0
' -----[ Initialization ]-------------------------------------------------------
'
Initialize:
DEBUG CLS ' open DEBUG window
PAUSE 500 ' let LCD settle
LCD_Setup:
LCDCMD LCDpin,%00110000 : PAUSE 5 ' 8 -bit mode
LCDCMD LCDpin,%00110000 : PAUSE 0
LCDCMD LCDpin,%00110000 : PAUSE 0
LCDCMD LCDpin,%00100000 : PAUSE 0 ' 4 -bit mode
LCDCMD LCDpin,%00101000 : PAUSE 0 ' 2 -line mode
LCDCMD LCDpin,%00001100 : PAUSE 0 ' no crsr, no blink
LCDCMD LCDpin,%00000110 ' inc crsr, no disp shift
LCDOUT LCDpin,ClrLCD,["BSP <--> PCF8583"] ' splash screen
Check_Set_Clock:
DEBUG "Would you like to set the clock? (Y/N)"
SERIN RxD,Baud96,10000,Main,[response]
idx = 99
LOOKDOWN response,["nNyY"],idx
idx = idx / 2
IF (idx = 0) THEN Main
Enter_Hours:
DEBUG CR, "Hours (0..23): "
SERIN RxD,Baud96,[DEC2 hours]
IF (hours < 24) THEN Enter_Minutes
hours = 6
Enter_Minutes:
DEBUG CR, "Minutes (0..59): "
SERIN RxD,Baud96,[DEC2 minutes]
IF (hours < 60) THEN Enter_Day
minutes = 0
Enter_Day:
DEBUG CR, "Day (0..6 [0 = Sunday]): "
SERIN RxD,Baud96,[DEC1 day]
IF (day < 7) THEN Set_The_Clock
day = 0
Set_The_Clock:
month = 9
date = 18
year = 1
GOSUB Put_Clock