Code:
eeprom 1,[31,28,31,30,31,30,31,31,30,31,30,31] ' month days lookup
' Set LCD DATA Port
'---------------------------------------------------------------
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
test var byte
test2 var byte
'--------------------------ds1820setup-------------------------------
DQ VAR PORTa.4 ' One-wire data pin
temperature VAR WORD ' Temperature storage
count_remain VAR BYTE ' Count remaining
count_per_c VAR BYTE ' Count per degree C
'-----------------------------thermostat -----------------------------------
symbol heatmat = porta.3
target var word
heatlevel var word
halfsec var byte
heatlevelx var byte
locate var byte
target = 30
halfsec = 1
locate = 13
temp var byte
temp = 30
temp2 var byte
temp2 = 20
'------------------------------RTCsetup--------------------------------
DS_SCL VAR PORTB.0 ' I2C clock pin
DS_SDA VAR PORTB.1 ' I2C data pin
RTC CON %11010000 ' RTC device address (byte addressing)
' -------------- RTC definitions -----------------
SecReg CON $00 ' seconds address (00 - 59)' MSB of SecReg must be set to a 0 to enable RTC
MinReg CON $01 ' minutes address (00 - 59)
HourReg CON $02 ' hours address (01 - 12) or (00 - 23)
DayReg CON $03 ' day address (1 - 7)
DateReg CON $04 ' date address (01 - 28/29, 30, 31)
MonthReg CON $05 ' month address (01 - 12)
YearReg CON $06 ' year address (00 - 99)
ContReg CON $07 ' control register
RTCflag CON 0 ' RTC flag (location 0 of internal EEPROM)
RTCset VAR BIT ' bit to check if RTC has been set
cntrl CON %00010000 ' sets the SQW/OUT to 1Hz pulse, logic level low
'----------------symbols-------------------------
symbol up = porta.0
symbol down = porta.1 'three button interface
symbol enter = porta.2
'-----------decimal value variables for menu display---------------
second var byte
minute var byte
hour var byte
day var byte
month var byte
year var byte
monthx var byte
wday var byte
second = 0
minute = 0
hour = 12 'set 12.00 1/1/08
day = 1
month = 1
year = 08
'--------hex value variables for actual time display--------------
secondx var byte
minutex var byte
hourx var byte
dayx var byte
monthxx var byte
yearx var byte
tempx var byte '' important this one
wdayx var byte
wdayx = $1 'just in case need a value maybe rubbish
secondx = $00 ' " "
'---------------------other not sure----------------------
decx var byte ' A swap variable
''''''''''''''''''''housekeeping'''''''''''''''''''''''
trisb = %00000000
trisa = %00000111
cmcon = 7 'switch off comparitor
Bookmarks