Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Real time clock error: it counts to 99 not 60 seconds !!

Status
Not open for further replies.

amredries

Member level 2
Joined
Jul 9, 2004
Messages
47
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,286
Activity points
259
real time clock

i have used real time clom ds1302 with pic 16f877
it seems that it work but i found that it count seconds from 0 to 99
not 60 seconds there somthing error happen when counting the seconds it jumps
for example 35 36 45

the code are

clock:
low rst 'reset the clock
low sclk

'set initial time 8:00am 16/07/99
rtcyear=$99
rtcday=$06
rtcmonth=$07
rtcdate=$16
rtchr=$08
rtcmin=0
rtcsec=0

gosub settime
'************************************************* **************
settime: 'set the time
rst=1 'enable data tx
shout io,sclk,lsbfirst,[$8e,0] 'enable write
rst=0 'reset RTC
rst=1 'ready for tx
'write all 8 RTC registers in burst mode
Shout io,sclk,LSBFIRST,[$be,rtcsec,rtcmin,rtchr,rtcdate,rtcmonth,rtcday,rt cyear,0]
rst=0 'reset RTC
return
'************************************************* **************
gettime: 'read the time from the RTC
rst=1 'ready for tx
shout io,sclk,LSBFIRST,[$bf] 'Read all 8 RTC registers in burst mode
Shin io,sclk,LSBPRE,[rtcsec,rtcmin,rtchr,rtcdate,rtcmonth,rtcday,rtcyea r,rtccontrol]
rst = 0 ' Reset RTC
Return

i am using picbasic

please help me
thanks
 

Re: real time clock

Hi amredries

The seconds register in the DS1302 has only 7 bits - bit0....bit6, bit7 is a control bit

Seconds (tens) bit 6,5,4..... (units) bit 3,2,1,0

These are transmitted LSB first ... 0,1,2,......6,7

Are you decoding these bits correctly?

Do the minutes readout correctly? They have the same format.

regards ... Polymath
 

real time clock

hi polymath
can you give me the code for this
thanks
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top