Code:Define LCD_DREG PORTB 'Set starting data bit Define LCD_DBIT 4 'rb4,rb5,rb6,rb7 'Set LCD RS Port DEFINE LCD_RSREG portb 'Set LCD RS Bit define LCD_RSBIT 3 'Set LCD Enable Port Define LCD_EREG portb 'Set LCD Enable Bit Define LCD_EBIT 2 'Set number of LCD Lines Define LCD_LINES 2 'Set Command Delay time in uS define LCD_COMMANUS 2000 'Set Data delay time in uS define LCD_DATAUS 50 ' ' Set Hardware Directions ' ----------------------- CMCON=%00000111 ' Disable Comparators TRISA=%00000111 ' PORTA all set to Output ' ' UP var PORTA.0 ' Press to Decrement Button Enter var PORTA.1 ' Press to Set/memorise Button Down var PORTA.2 ' Press to Increment Button CounterC var Byte LCDOut $FE,1 ' Clear LCD CounterC=0 ' Set to Start of Setup (seven steps from 0 to 6) SetupLoop: LCDOut $FE,1,"Set " pause 1000 ' If CounterC=0 then LCDOut "Real Time" endif If CounterC=1 then LCDOut "On Time" endif If CounterC=2 then LCDOut "Off Time" endif If CounterC=3 then LCDOut "Date" endif If CounterC=4 then LCDOut "Day Temp" endif If CounterC=5 then LCDOut "Night Temp" endif If CounterC=6 then LCDOut "MODE" endif ' ' -------------------- SetupDisplayLoop: If Enter = 1 then if CounterC=0 then Set_time If counterC=1 Then Set_ontime if counterC=2 Then Set_offtime if counterC=3 Then Set_Date if counterC=4 Then Set_dtemp if counterC=5 Then Set_ntemp if counterC=6 Then Set_Btemp endif if enter = 1 then counterC = counterC + 1 if counterC >= 7 then counterC = 0 endif endif goto setupLoop Set_time: Set_ontime: Set_offtime: Set_Date: Set_dtemp: Set_ntemp: Set_Btemp: End




Bookmarks