hello I have the datasheet and this example
An example program to test I2C-RTC Real-time Clock.
' The program is set of display the current time.
' The program is working directly with I2C-RTC module.
'
' Note: This program was tested using PICAXE 28X-1 Firmware version 2
'
' Document: DS1340 datasheet
' Updated: July 30, 2008
' E-mail:
support@gravitech.us
' Gravitech
' (C) Copyright 2008 All Rights Reserved
'************************************************************
symbol I2C_ADDR = $D0 ' I2C address
symbol Second = b1 ' Store second value
symbol Minute = b2 ' Store minute value
symbol Hour = b3 ' Store hour value
symbol Day = b4 ' Store day value
symbol Date = b5 ' Store date value
symbol Month = b6 ' Store month value
symbol Year = b7 ' Store year value
symbol Command = b8 ' Set/Read time
MAIN:
PAUSE 1000 ' Delay 1 second
' Display menu
sertxd (CR, LF, "What would you like to do?",CR,LF)
sertxd ("(0) To set the current time.", CR,LF)
sertxd ("(1) To display the current time.",CR,LF)
sertxd (CR,LF,"Enter 0 or 1 then hit ENTER and Send: ")
' Get input
serrxd #Command
sertxd (#Command) ' Echo input value
Command = BINTOBCD Command
IF Command = 0 THEN ' Goto Display time subroutine
GOSUB Settime
ELSE IF Command = 1 THEN ' Goto Set time subroutine
GOSUB Displaytime
ENDIF
GOTO MAIN
'**************************************************************
' Display time subroutine
'**************************************************************
Displaytime:
i2cslave I2C_ADDR, i2cslow, i2cbyte
readi2c 0, (Second,Minute,Hour,Day,Date,Month,Year)
'Formatting the numbers for display
Second = BCDTOBIN Second
Minute = BCDTOBIN Minute
Hour = BCDTOBIN Hour
Day = BCDTOBIN Day
Date = BCDTOBIN Date
Month = BCDTOBIN Month
Year = BCDTOBIN Year
sertxd (CR,LF)
sertxd (CR,LF,"The current time is ",#Month,"/",#Date,"/20")
IF Year <= 9 THEN
sertxd ("0")
ENDIF
sertxd (#Year," ",#Hour,":",#Minute,".",#Second,CR,LF,LF)
RETURN
'**************************************************************
' Set time subroutine
'**************************************************************
Settime:
sertxd (CR,CR,LF,"Enter hours (00-23): ")
serrxd #Hour
sertxd (#Hour) ' Echo input value
Hour = BINTOBCD Hour
Hour = Hour & %00111111 ' Disable century
sertxd (CR,LF,"Enter minutes (00-59): ")
serrxd #Minute
sertxd (#Minute) ' Echo input value
Minute = BINTOBCD Minute
sertxd (CR,LF,"Enter seconds (00-59): ")
serrxd #Second
sertxd (#Second) ' Echo input value
Second = BINTOBCD Second
Second = Second & %01111111' Enable oscillator
sertxd (CR,LF,"Enter day (01-07): ")
serrxd #Day
sertxd (#Day) ' Echo input value
Day = BINTOBCD Day
sertxd (CR,LF,"Enter date (01-31): ")
serrxd #Date
sertxd (#Date) ' Echo input value
Date = BINTOBCD Date
sertxd (CR,LF,"Enter month (01-12): ")
serrxd #Month
sertxd (#Month) ' Echo input value
Month = BINTOBCD Month
sertxd (CR,LF,"Enter year (00-99): ")
serrxd #Year
sertxd (#Year) ' Echo input value
Year = BINTOBCD Year
i2cslave I2C_ADDR, i2cslow, i2cbyte
writei2c 0,(Second,Minute,Hour,Day,Date,Month,Year)
sertxd (CR,LF)
sertxd (CR,LF,"The current time has been successfully set!", CR,LF,LF)
RETURN
END
how can I show the clock withow sertxd, because I dont have one wire lcd, I have a lumex lcd with rs,E, etc