Hello Steve,
I am using the RTC DS3232 from dallas. you said you have used it before. Can you share your picbasic code? I am having trouble setting the time.
when i read the time and date. I get them all as 4.
Here is mine:
'Using the pic 16f630
include "modedefs.bas"
define OSCCAL_1k 1
CMCON=%0000011' Turn off comparator module
minutes var byte
hours var byte
day var byte
date var byte
month var byte
year var byte
reset Var PORTC.0
rtcyear var byte
rtcday var byte
rtcmonth var byte
rtcdate var byte
rtchour var byte
rtcmin var byte
rtcsec var byte
' Set initial time to 8:00:00AM 07/16/99
rtcyear = $99
rtcday = $06
rtcmonth = $07
rtcdate = $16
rtchour = $08
rtcmin =0
rtcsec =0
startbigNums con 2
endBigNums con 3
clrLCD CON 12
backLightOn con 14
backLightOff con 15
cursorPos con 16
enter con 10
bell con 7
b2 var byte
CONTL CON %01101000
Low reset 'reset the RTC
input reset ' undo reset..basically it puts pin reset at high impedance
'Set the time
I2cwrite PORTC.2,PORTC.1,CONTL,$01,[rtcmin] 'minutes
I2cwrite PORTC.2,PORTC.1,CONTL,$02,[rtchour]'hours
I2cwrite PORTC.2,PORTC.1,CONTL,$03,[rtcday] 'day
I2cwrite PORTC.2,PORTC.1,CONTL,$04,[rtcdate]'date
I2cwrite PORTC.2,PORTC.1,CONTL,$05,[rtcmonth]'month
I2cwrite PORTC.2,PORTC.1,CONTL,$06,[rtcyear] 'year
pause 10
'Low reset
'input reset
I2cread PORTC.2,PORTC.1,CONTL,$01,[minutes]
I2cread PORTC.2,PORTC.1,CONTL,$02,[hours]
I2cread PORTC.2,PORTC.1,CONTL,$03,[day]
I2cread PORTC.2,PORTC.1,CONTL,$04,[date]
I2cread PORTC.2,PORTC.1,CONTL,$05,[month]
I2cread PORTC.2,PORTC.1,CONTL,$06,[year]
serout2 0,16780,[clrLCD,"Time",hex hours,":",hex minutes,enter,_
"date:",hex date,"/",hex month,"/",hex year]
end
Bookmarks