Real time clock ICs - Page 2


Closed Thread
Page 2 of 2 FirstFirst 12
Results 41 to 67 of 67
  1. #41
    Eng4444's Avatar
    Eng4444 Guest


    Did you find this post helpful? Yes | No

    Lightbulb LCD datasheet.

    Hello again :-)

    i just wanted to check befor sleeping if someone has answered. and Here i found yours BobK.

    thank you for the notes. I'll take them into consideration tomorrow.

    Here i attached the datasheet for you. So don't wait for winstar... sometimes they take lot of time.

    i hope i provided you with everything.

    By the way,

    the matter of variable resistor wasn't included because i just forgot to put it. But i assure you that i connected it in a good way and worked fine.

    So in case you wanna include or add something, i'll be thankful for the time you gave to me.

    Good night now... i'm soooooooooooooooooooo tired :-(
    Attached Images Attached Images  

  2. #42
    Join Date
    May 2006
    Location
    Del Rio, TX, USA
    Posts
    343


    Did you find this post helpful? Yes | No

    Default Better LCD Data sheet

    BobK,
    The "datasheet" Eng4444 posted was a bit sparse, but did reference the KS0066 or equivalant controler.

    Hope this helps, and it looks like you are correct about the data lines to the LCD, they should be D4-D7 (not D0-D3) in 4 bit mode.

    Steve B

  3. #43
    Join Date
    Sep 2004
    Location
    Mentor, Ohio
    Posts
    352


    Did you find this post helpful? Yes | No

    Smile

    Hi Steve,

    Yes I saw that information. I was worried since I said that. The displays that Melanie uses must use D0 thru D3. I really didn't want to cross her. Her stuff is really pretty good. I know now I'll feel the pain of her whip! I checked some of the things I did with 4 bit LCD's and they all used D4 thru D7 which is why I said that. I even looked in the PBP manual and that example is also D4 to D7. Later I looked at her 1307 Clock program and said OH NO! But considering everything that ENG4444 has been thru it can't hurt to try it. I do hope it works for him.

    Thanks for the datasheet help, Steve. I saved it in my reference files.

    BobK

  4. #44
    Join Date
    Mar 2006
    Location
    China
    Posts
    266


    Did you find this post helpful? Yes | No

    Default I would like to add

    Hi,

    I would like to add a 4k7 resistor between DS1307 (pin7) and 5V as a pullup resistor and as said many times before GND the backup battery pin.

  5. #45
    Join Date
    May 2006
    Location
    Del Rio, TX, USA
    Posts
    343


    Did you find this post helpful? Yes | No

    Default No Pull-ups for the Buttons?

    I haven't gone through the code completely, but taking another quick look at the schematic I noticed there aren't any pull-ups used for the buttons. I did see a TRISB=%11111111 in there, as well as checking one of the buttons low as a condtion in an IF...THEN statement used to enter the SetupEntryLoop (I am assuming the logic is the same on all three). So they are floating, and should be pulled-up. You could just use those 10K pull-ups you removed from the SCL/SDA lines (which should now have 4.7K) and add them to the pins for each of the buttons. Just need one additional for the third button.

    Steve

  6. #46
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    Gawd, that's a four-year-old program and you expect me to remember what LCD's I was using at the time? I do recall that you could use either the upper or lower 4-bits. On checking the current DATASHEET (Datasheets always seem to come into the conversation on this thread) I find that Tri-T (our currect supplier) only supports the UPPER four bits. So this is obviously non-standard. I'd connect as per the PBP manual, but using the Port pins as specified in the DEFINES within the program. I've tried the original MN1307 this morning (I've not checked the posted version) connected that way and it works.

    Buttons are on PortB and use the PICs internal weak pull-up's.

  7. #47
    Eng4444's Avatar
    Eng4444 Guest


    Did you find this post helpful? Yes | No

    Lightbulb Good morning!:-)

    The best thing is to have a huge project done ahead of time... everybody there is still working.

    I checked all the comments i have. Thank you for your cooperation :-)

    how would i know that they should have been D4 throught D7.... i do not work with electronics and i was doing exactly as it was said.

    i will try all what was said in 2 hours and then give feedback.

    i wish a nice day for everybody!

  8. #48
    Eng4444's Avatar
    Eng4444 Guest


    Did you find this post helpful? Yes | No

    Lightbulb Hello Melanie!

    Seems we sent our posts in the same time!


    SO you are saying that i can connect to the lower 4 bits as long as i keep the "defines" in the program?

    And in case i will use from D4 to D7 i should change the "defines".
    So what to change in this part if so?

    "

    Define LCD_DREG PORTA ' Port for LCD Data
    Define LCD_DBIT 0 ' Use lower 4 bits of Port
    Define LCD_RSREG PORTA ' Port for RegisterSelect (RS) bit
    Define LCD_RSBIT 6 ' Port Pin for RS bit
    Define LCD_EREG PORTA ' Port for Enable (E) bit
    Define LCD_EBIT 7 ' Port Pin for E bit
    Define LCB_BITS 4 ' Using 4-bit bus
    Define LCD_LINES 2 ' Using 2 line Display
    Define LCD_COMMANDUS 2000 ' Command Delay (uS)
    Define LCD_DATAUS 50 ' Data Delay (uS)

    "

    i'll check this this thread when i arrive to my Lab.

    By the way,
    Don't you think people that this thread reached the highest score of visits?! hehe.

    Let's reach the highest possible number! :-)

  9. #49
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    There is a very basic software only (no RTC chip required) elapsed timer demo, ready to run, just an LCD and one Button only, at the bottom of this thread here...

    http://www.picbasic.co.uk/forum/showthread.php?t=3423

  10. #50
    Eng4444's Avatar
    Eng4444 Guest


    Did you find this post helpful? Yes | No

    Lightbulb I am in Lab now.

    Hello,

    Here i arrived and will test your program....

    honestly, i liked the first program because it gives time and date. I really hope it will work.

    By the way, don't think that i will say that "i" did it. But i will show the source of it and all the posts and replies for this thread.

    i really hope i'll ba able to see something on LCD.

    First thing is that i will change the bits from D4 TO D7 and connect them to PIC; moreover, i will put 4.7 K resistors and 0.1uF Capcitors

    More infos to come soon!

  11. #51
    Eng4444's Avatar
    Eng4444 Guest


    Did you find this post helpful? Yes | No

    Exclamation First thing to be said..

    I connected all the circuit with the new changes and then downloaded the program after adding the following:

    @ DEVICE pic16F628A, INTRC_OSC_NOCLKOUT
    ' System Clock Options
    @ DEVICE pic16F628A, WDT_ON
    ' Watchdog Timer
    @ DEVICE pic16F628A, PWRT_ON
    ' Power-On Timer
    @ DEVICE pic16F628A, BOD_ON
    ' Brown-Out Detect
    @ DEVICE pic16F628A, MCLR_OFF
    ' Master Clear Options (Internal)
    @ DEVICE pic16F628A, LVP_OFF
    ' Low-Voltage Programming
    @ DEVICE pic16F628A, CPD_OFF
    ' Data Memory Code Protect
    @ DEVICE pic16F628A, PROTECT_OFF
    ' Program Code Protection

    So now , when i compile with microcoe studio it compiles successfully. Bu when i want to program the IC, it gives a message :

    " this program contains EEDATA - EDATA and this part will be discarded"

    so i press "OK" and it begins programming.

    during the process, when it arrives to " Programming EEDATA section" it stops and gives this message:
    " Programming time-out or connection error"

    For sure i have no connection error because i tried a small program on another IC and it worked.

    any idea?

  12. #52
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    Not from me, I don't use Microcode studio and avoid any questions on the topic.

    If you compiled your MN1307.bas code from a DOS Window...

    PBP -p16F628 MN1307 -v

    or

    PBP -p16F628A MN1307 -v

    depending which version you're using... It will compile.

    Likewise I can't comment on your method of programming the actual PIC.

  13. #53
    Eng4444's Avatar
    Eng4444 Guest


    Did you find this post helpful? Yes | No

    Arrow Dear Melanie,

    A real BIG thanks for this nice code.

    Here it worked :-)

    it is displaying time and date.

    Still a small problem that i will describe in details:

    1- it says to chose between 24 hours or 12 hours and this is working fine.
    2- chose time and date and things are also fine. In fact i chose today's date and time.

    3- when i press the middle button again to save, it says: MEMORIZED.

    but since then, time is not being updated on the screen. It is left all the time as i have set it since the beginning. I have waited 30 minutes and nothing has changed.

    By the way, i used the 3V battery and noticed that everything was changed to 4 whether by number or place. What i mean is:
    04:04:04
    04 Apr 2004

    so what do you suggest to do?

    more than 3/4 of the work is done and i need to continue it till the end.

    thanks in advance.

    By the way Bobk,

    i didn't use any capacitors but you were right about D4 till D7.
    so help me to finish it....

    I'll check in 1 hour.

    Bye.

  14. #54
    Join Date
    Sep 2004
    Location
    Mentor, Ohio
    Posts
    352


    Did you find this post helpful? Yes | No

    Smile

    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

  15. #55
    Eng4444's Avatar
    Eng4444 Guest


    Did you find this post helpful? Yes | No

    Exclamation Same problem remaining..

    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.

  16. #56
    Eng4444's Avatar
    Eng4444 Guest


    Did you find this post helpful? Yes | No

    Angry Still not working...

    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..

  17. #57
    Join Date
    Sep 2004
    Location
    Mentor, Ohio
    Posts
    352


    Did you find this post helpful? Yes | No

    Smile

    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

  18. #58
    Join Date
    Sep 2004
    Location
    Mentor, Ohio
    Posts
    352


    Did you find this post helpful? Yes | No

    Smile

    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

  19. #59
    Eng4444's Avatar
    Eng4444 Guest


    Did you find this post helpful? Yes | No

    Lightbulb Dear 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! :-)

  20. #60
    Eng4444's Avatar
    Eng4444 Guest


    Did you find this post helpful? Yes | No

    Arrow copy/paste.

    Quote Originally Posted by BobK
    Hi Eng4444,

    did you copy and paste her code or did you retype the whole thing?

    BobK
    i just copied and paste... why to type it again...?

    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.

  21. #61
    Eng4444's Avatar
    Eng4444 Guest


    Did you find this post helpful? Yes | No

    Default i asked a professor

    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......

  22. #62
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    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...

  23. #63
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    I have downloaded the MN1307 program from the MeLabs website.

    I have breadboarded the hardware and wired it per instructions with the exception that I've wired the LCD using DB4 thru 7 rather than DB0 thru 3.

    I have run the program.

    I have verified that it works as advertised.

    I have posted proof here that it works. I have an MPEG video of it ticking away... you want me to email that you?

    I don't post programs that don't work.

    Now your problem...

    It doesn't tick, then the software is just a simple loop that reads the RTC and displays the results on the LCD... this means your RTC isn't working. Also, if on initial first-time power-up it doesn't immediately jump into set-up, then that tells me the RTC isn't communicating with the PIC.

    so...

    1. Verify that SCL and SDA are wired correctly and you haven't swapped them over and you've not got any shorts.

    2. Make sure you have pull-up Resistors on those pins. 10K will work, 4K7 with hindsight is probably better.

    3. Make sure you have a Battery Connected.

    4. If you haven't got a Battery, then connect the Battery pin to Vss.

    5. Make sure your 32kHz Crystal is connected - and it's a good one. Steal one from your average genuine 99-cent Rolex wristwatch if you have any problems.

    6. Ensure you have a good RTC chip.

    If it still doesn't work, go back to step 1 and start over.

    ...i'll pass a whooooooole month in the Carribean!
    Hurry back, because we're all going to miss you when you're gone...
    Attached Images Attached Images  

  24. #64
    Eng4444's Avatar
    Eng4444 Guest


    Did you find this post helpful? Yes | No

    Talking Dear Melanie

    Quote Originally Posted by Melanie
    Hurry back, because we're all going to miss you when you're gone...
    __________________________________________________ ______________

    You know?

    i always have found your replies cool. You seem too much easy going and from the calm type.This is wonderful!

    till now, i'm still thinking about that 99 cents watch! From where do you bring all those stupid jokes?

    Keep on the good job!

    Here we reached more than 1000 people who checked this thread! is it enough or we make them 2000?

    Best regards.... ;-)

  25. #65
    Early1's Avatar
    Early1 Guest


    Did you find this post helpful? Yes | No

    Smile

    Thirty years ago when I was in the same position as Eng444, at University working on projects for my Bsc in Civil Engineering, I used a stop watch.

    A mechanical one at that.

    I am realy intrigued as to why any one has gone to so much trouble to re invent the wheel, or egg timer in this case.

    I work in instrumentation and RTC are used extensively because we need to log data with a time and date stamp, and if I was going to build a data logger then I would use a RTC, but then I would not build one because I can buy a very good tested and reliable datalogger for £240.

    Puzzled

    Steve

  26. #66
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    Steve

    It's 23:58:43 on 28th February... You need a three-minute egg... you're in a panic because PAUSE 180000 exceeds a WORD variable. Do you stop the clock at 12:01:43am or at 00:01:43, and will it be on the 29th February or on the 1st March? Deep down, you KNOW the DS1307 was built by Maxim/Dallas just to provide you with these very answers.

    Melanie

  27. #67
    Join Date
    Apr 2006
    Location
    New Hampshire USA
    Posts
    298


    Did you find this post helpful? Yes | No

    Thumbs up This looks sooooo familiar.

    There is project building. Planning and physically building a project. Writing the code and testing. When it does something unexpected (that would include not working). There is “troubleshooting”.

    Troubleshooting is an art. There are efficient ways and there are inefficient ways to accomplish the same end. The problem seems to be that some people just want the answer, not the procedure. They seem to think that someone can see their circuit, and mystically, clairvoyantly, pass their long-distant hand over the program or circuit and KNOW what their mistake is.

    Real problems arise when the person ASKING for HELP thinks the helper is just asking silly questions and asking them to do silly things. All that the person ASKING for help wants is an ANSWER. So they end up DEMANDING that the foolish, silly, questions STOP, and GIVE ME THE ANSWER that I need.

    So we are “stuck” with the “basic” truthful ANSWER , “I Don’t Know”.

    See also

    Quote Originally Posted by Eng4444 View Post
    i did the same connections shown in the shematic , downloaded the same program (that is displayed here) inside PIC16F628A, gave 5VDc and checked the connections again. But i didn't see anything on LCD.......
    ...SO now, you will keep on saying that i have to read datasheets??

    or you will try to help me in an effective way?

    Friday i will present it in front of jury and MONDAY..... i'll graduate :-) and since then, i'll pass a whooooooole month in the Carribean!

    ...so i will just sleep......

    Please guys, take it into consideration and check that schematic and program... tomorrow i'll be well awake so i'll concentrate on your replies and try to accomplish what you told me to do..

    But please, please , please........ stop talking about datasheets...
    -Adam- (this was mis-posted (by me) should have gone in answer to: http://www.picbasic.co.uk/forum/show...2&postcount=25
    Last edited by Pic_User; - 20th October 2008 at 16:09.
    Ohm it's not just a good idea... it's the LAW !

Similar Threads

  1. real time clock
    By maria in forum Code Examples
    Replies: 44
    Last Post: - 1st March 2022, 12:13
  2. Real Time Clock
    By in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 2nd June 2012, 04:52
  3. real time clock - PCF8583
    By maria in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 15th April 2010, 15:41
  4. Real Time Clock
    By savnik in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 8th December 2006, 02:02
  5. Real time clock... what a headache!
    By Eng4444 in forum mel PIC BASIC
    Replies: 2
    Last Post: - 8th June 2006, 21:56

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts