Parallax, Inc. • BS2p “Plus Pack” (#45184) • 10/2001
Page 22
LCDpin CON 0 ' LCD is connected to OutL
I2Cpin CON 8 ' SDA on 8; SCL on 9
RxD CON 16 ' serial receive (from DEBUG)
' -----[ Constants ]------------------------------------------------------------
'
DevType CON %1010 << 4 ' device type
DevAddr CON %000 << 1 ' address = %000 -> %001
Wr8583 CON DevType | DevAddr ' write to PCF8583
Rd8583 CON Wr8583 | 1 ' read from PCF8583
' LCD control characters
'
NoCmd CON $00 ' just print
ClrLCD CON $01 ' clear the LCD
CrsrHm CON $02 ' cursor home
CrsrLf CON $10 ' cursor left
CrsrRt CON $14 ' move cursor right
DispLf CON $18 ' shift display left
DispRt CON $1C ' shift displayright
DDRam CON $80 ' Display Data RAM control
Line1 CON $80 ' address of line 1
Line2 CON $C0 ' address of line 2
Yes CON 1
No CON 0
Baud96 CON 240 ' 9600-8-N-1 (matches DEBUG)
' -----[ Variables ]------------------------------------------------------------
'
seconds VAR Byte
minutes VAR Byte
hours VAR Byte
day VAR Nib ' 0 - 6 (day of week)
date VAR Byte ' 1 - 31
month VAR Nib
year VAR Nib ' 0 - 3 (LeapYear offset)
rawTime VAR Word ' minutes past midnight
regCtrl VAR Byte ' [0] control/status
regHuns VAR Byte ' [1] hundredths (bcd)
regSecs VAR Byte ' [2] seconds (bcd)
regMins VAR Byte ' [3] minutes (bcd)
regHrs VAR Byte ' [4] hours (bcd)
regYrDate VAR Byte ' [5] year & date (bcd+)
regMoDay VAR Byte ' [6] day & month (bcd+)
regAddr VAR Byte ' register address
regData VAR Byte ' data to/from register
eeAddr VAR Byte ' EE data pointer
char VAR Byte ' character from EE
idx VAR Byte ' loop counter
response VAR Byte
' -----[ EEPROM Data ]----------------------------------------------------------
'