Hi Eng4444,
I'm glad to hear that you got it working. Now put the .1uF capacitors across each device and reset the project and see if it works. I slept in this morning so I'm running late for work. Keep plugging away!
BobK
Hi Eng4444,
I'm glad to hear that you got it working. Now put the .1uF capacitors across each device and reset the project and see if it works. I slept in this morning so I'm running late for work. Keep plugging away!
BobK
i got busy a bit and now i returned to work.
I added the capacitors but nothing happened. the time is not advancing!!!!
i changed the cristal (32.768) and placed a new one but also nothing happened...
what is the reason??
i can easily go to the menu and set the time and date whenever i want but after i see : "MEMORIZED", time and date freeze on LCD...
can you help me Melanie? or anyone else..
thanks.
i added even a cristal 4M betweens pins 15 and 16 for the PIC16F628A with 2 capacitors but i'm still having same problem... time is not changing.
It is just freezing on the LCD without any change...
i also replaced the DS by a new IC and i still have the same problem..
You guys should have expertise in those things and similar cases... i hope you will discover the matter...
By the way, i also replaced the cristal of DS by another new one and i still have same problem...
waiting for something from your part..
Hi Eng4444,
Just got home from work and see that you are still having a problem. Just a quick question. Is the ability to set the time with the 3 push buttons really critical for you to show what you have done? If not then you could go to the part of the code that starts with "SETUP PRESET:" and enter the starting time and date manually. I will look over the code here this evening and get back to you on that.
Adding the capacitors (.1uF) has nothing to do with this problem. They are part of good design practice.
Just so I understand what has happened: You programmed the micro and the system started running and time and date was being displayed. You went into the set time and date mode and it accepted your time and date changes. Then you pressed the button to send you changes to the RTC and that's when it froze.
I will look for that part of the code you sent me and compare it with Melanie's posted code. Just out of curiosity, did you copy and paste her code or did you retype the whole thing?
Let me know. Thanks!
BobK
HI Eng4444,
The program listing that you sent me has the following last line:
LCDOut $FE,1,"Memorised"
Do you have anything after that? There's more to it like the part that writes the new values to the RTC. I got the following from Melanie's code:
' Make the User feel happy
' Save 12/24 Hours to BCD DS1307's Format
' ---------------------------------------
CounterA=SetHour
If SetTime=1 then
If CounterA>12 then CounterA=CounterA-12
If CounterA=0 then CounterA=12
endif
Gosub ConvertBCD
RTCHour=CounterB
' Save the Hours Value
If SetTime=1 then
RTCHour.6=1
' Save the 12 Hour Mode Flag
If SetHour=>12 then RTCHour.5=1
' Save the 'PM' Flag
endif
'
' Save Minutes
' ------------
CounterA=SetMin
Gosub ConvertBCD
RTCMin=CounterB
'
' Save Seconds
' ------------
CounterA=SetSec
Gosub ConvertBCD
RTCSec=CounterB
'
' Save Year
' ---------
CounterA=SetYear
Gosub ConvertBCD
RTCYear=CounterB
'
' Save Month
' ----------
CounterA=SetMonth
Gosub ConvertBCD
RTCMonth=CounterB
'
' Save Day
' --------
CounterA=SetDay
Gosub ConvertBCD
RTCDay=CounterB
'
' Calculate Day of Week & Save
' ----------------------------
' Melanie's fudge for calculating Days of Week
' using PBP's integer math...
' by the time someone's clock displays the
' the wrong Day of Week, I'll hopefully have long
' retired and be past caring...
' I wouldn't however go stick this routine in a
' Nuclear Power Station to purge the reactor
' every Monday morning without checking how far it
' will work before the integer math overflows...
' In my routine RTCWDay=1 is a Tuesday (the
' start of my week) and continues sequentially
' until RTCWDay=7 which is a Monday
CounterA=SetYear+4
CounterB=SetMonth
If SetMonth<3 then
CounterA=CounterA-1
CounterB=CounterB+12
endif
CounterD=(SetDay+(153*CounterB-457)/5+365*CounterA+CounterA/4-CounterA/100+CounterA/400+2) MOD 7
RTCWDay=CounterD+1
'
' Do the Business
' ---------------
I2CWrite SDApin,SCLpin,$D0,$00,RTCSec,RTCMin,RTCHour,RTCWDa y,RTCDay,RTCMonth,RTCYear,RTCCtrl]
Pause 1000
Gosub SetButtonRelease
Goto ReDisplay
endif
Gosub SetButtonRelease
Goto SetupLoop ' Loop for Next Menu Item
endif
'
' Menu TimeOut Counter
' --------------------
Pause 1 ' Kill 1mS
TimeOut=TimeOut+1
If TimeOut>20000 then goto ReDisplay
' User paused too long
' Return User to Time & Date Display
' This will however bounce the User to the original
' Setup Menu start point if the DS1307 has not
' been initialised
Goto SetupEntryLoop ' Loop for Button Press
'
End
Check this out> It could be why you're not working.
BobK
i re-donloaded the program but everything is still freezing.
Time is not advancing (i mean being incremented).
Melanie didn't answer yet so i think she might have a good answer...
Today is my Presentation! :-)
i just copied and paste... why to type it again...?Originally Posted by BobK
i wish it will work!
It's so strange!
i changed DS1307, PIC 16F628A, cristal 32,768...i changed them all to newer parts.. and then i re-downloaded the program..
but there is something strange happening.
He said that i should keep on clearing the PIC in order to make time advance...
i dunno what does this mean but there is no "CLEAR" port on the 16f628A datasheet......
I will check later in the day when I have a few minutes spare... some of us have more important commitments and have to work for a living too...
Bookmarks