ds 1307 revisted


Closed Thread
Results 1 to 10 of 10
  1. #1

    Default ds 1307 revisted

    still having problems starting the clock

    any suggestions seem to have program correct just clock dont want to start
    have pullup on sda and scl
    grounded batt connection
    have 5 volts
    and send a $00 to secs to init

    help??

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


    Did you find this post helpful? Yes | No

    Smile

    Hi jcleaver,

    Well the obvious things to check are the crystal, the SDA and SCL pins aren't reversed, the sec.7 setting and the batt pin grounded or connected to a battery.

    I personally use the DS1337 RTC. It doesn't have a batt pin and it doesn't have a startup register to set. BUT, when I first started using it I thought any 32K crystal would work. I was way off on that one. Every one of my clocks gained time and fast! Reading the fine print in the datasheet for the 1337 RTC shows the crystal needs to have a 6pf capacitance load. Bought the right crystal and they haven't missed a beat yet! Back to your problem.

    Triple check the SDA and SCL pins to make sure they aren't reversed. Just for the hell of it, read and display RTCSec.7 to make sure it is set to 0. I know I read your posts about sending a $00 to the sec register but I would at least try sending RTCSec.7 = 0 to see if the clock doesn't start running.

    I would also try setting up the mentioned program from Melanie MN1307. At least here you know for sure the program works. If you 1307 works in her program then you've got some direction to look in.

    I've done several projects now with the DS1337 and I haven't had any problems other than the crystal.

    HTH,

    BobK
    Last edited by BobK; - 9th February 2007 at 22:24.

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


    Did you find this post helpful? Yes | No

    Smile

    Hi jcleaver,

    Well the obvious things to check are the crystal, the SDA and SCL pins aren't reversed, the sec.7 setting and the batt pin grounded or connected to a battery.

    I personally use the DS1337 RTC. It doesn't have a batt pin and it doesn't have a startup register to set. BUT, when I first started using it I thought any 32K crystal would work. I was way off on that one. Every one of my clocks gained time and fast! Reading the fine print in the datasheet for the 1337 RTC shows the crystal needs to have a 6pf capacitance load. Bought the right crystal and they haven't missed a beat yet! Back to your problem.

    Triple check the SDA and SCK pins to make sure they aren't reversed. Just for the hell of it, read and display RTCSec.7 to make sure it is set to 0. I know I read your posts about sending a $00 to the sec register but I would at least try sending RTCSec.7 = 0 to see if the clock doesn't start running.

    I would also try setting up the mentioned program from Melanie MN1307. At least here you know for sure the program works. If you 1307 works in her program then you've got some direction to look in.

    I've done several projects now with the DS1337 and I haven't had any problems other than the crystal.

    HTH,

    BobK

  4. #4


    Did you find this post helpful? Yes | No

    Default ?

    bob thanks for the update
    where did you get the right crystal? part #

    and where can you find info on the rtcsec command?

    melanies programj looks great but cannot make it work not smart enough to know whats wrong
    only one works seems to do ok most of the time have listed for any responces
    still need to work on serring the clock
    again thanks
    jack' PicBasic Pro program to display result of
    ' 8-bit A/D conversion on LCD
    '
    ' Connect analog input to channel-0 (RA0)
    @ DEVICE pic16f877a, HS_OSC, WDT_ON, PWRT_ON, LVP_OFF, PROTECT_OFF

    ' Define LCD registers and bits
    Define LCD_DREG PORTB ' Port for LCD Data
    Define LCD_DBIT 4 ' Use upper 4 bits of Port
    Define LCD_RSREG PORTB ' Port for RegisterSelect (RS) bit
    Define LCD_RSBIT 3 ' Port Pin for RS bit
    Define LCD_EREG PORTB ' Port for Enable (E) bit
    Define LCD_EBIT 2 ' 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)




    DEFINE OSC 20
    ' Define ADCIN parameters
    Define ADC_BITS 8 ' Set number of bits in result
    Define ADC_CLOCK 3 ' Set clock source (3=rc)
    Define ADC_SAMPLEUS 50 ' Set sampling time in uS
    define loader_used 1
    adval var byte ' Create adval to store result
    AD33 VAR BYTE
    W1 VAR WORD 'PUSHBUTTON
    I VAR WORD
    TRISA = %11111111 ' Set PORTA to all input
    TRISD = %11111111 ' SET PORTD TO INPUT
    ADCON1 = %00000010 ' Set PORTA analog
    ' Low PORTE.2 ' LCD R/W line low (W)
    ' Define I2C bus ports
    B0 VAR BYTE
    B1 VAR BYTE
    B2 VAR BYTE
    SDA VAR PORTC.4 'DS1307 SDA pin
    SCL VAR PORTC.3 'DS1307 SCL pin
    DEFINE I2C_SLOW 1
    DEFINE I2C_HOLD 1
    DEFINE I2C_SCLOUT 1
    Pause 500 ' Wait .5 second
    ADDR VAR BYTE
    ADDR = 0
    PAUSE 1000
    CONT CON %11010000

    secs var byte
    mins var byte
    hrs var byte
    day var byte
    date var byte
    month var byte
    year var byte
    ctrl var byte
    x var byte

    x=0
    for x= 1 to 5
    I2CWRITE SDA,SCL,CONT,ADDR,[$00,$59,$11,$03,$25, $12 ,$03, $10]
    PAUSE 500
    next x
    'I2CREAD SDA,SCL,CONT,ADDR ,[b2]

    loop:

    COUNT portd.1,750,w1
    lcdout $fe,1
    pause 1000

    lcdout $fe,$80+4 ,"count: ", dec w1
    pause 500
    I2CREAD SDA,SCL,CONT,ADDR ,[secs,mins,hrs,day,date,month,year,ctrl]
    pause 5000
    ADCIN 0, adval ' Read channel 0 to adval
    ADCIN 1, AD33
    Lcdout $fe, 1 ' Clear LCD
    Lcdout "Value: ", # adval ' Display the decimal value
    LCDOUT $FE,$C0, "VALUE : ", DEC AD33
    Pause 500 ' Delay for .5 seconds
    lcdout $fe,1 ' clear display
    lcdout "min: ", hex mins
    lcdout $FE,$C0,"secs: ",hex secs
    pause 1000



    Goto loop ' Do it forever
    End

    seem to have something strange about my setup
    wish i knew
    Last edited by jcleaver; - 10th February 2007 at 01:34. Reason: forgot something

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


    Did you find this post helpful? Yes | No

    Smile

    Hi Jack,

    1. The DS1307 needs a crystal with a 12.5pf load. That part # is DigiKey SE3201-ND or SE3202-ND or SE3203-ND. The difference between them is physical size with the 3201 being the largest and the 3203 being the smallest and the more expensive. 3201 and 3202 are $.27 in single lot and the 3203 is $1.38 single lot. You can find them on page 1135 of their current catalog.

    2. RTCsec came from the MN1307 program. You have your "secs" register which is the same thing.

    3. If I were you, at this point, I would strip the program down and only put the LCD items in there first, make sure the LCD works, then I would add just the clock stuff. I have attached a DS1307 program I got off of another PIC group. I do believe our own Darrel Taylor was a part of the discussion on getting the clock chip to work. When you look at this program you will see that there are RTC register assignments as constants. You don't seem to have them in what you posted here. This may be part of the problem. This listing I have attached is very close to what I have for my DS1337 program. Try this program just with the LCD portion of your program and see if it doesn't get you going. You shouldn't have to make any pin assignment changes. SDA and SCL are the same pins.

    You can set the time values to your current time, just make sure the secs are set to $00.

    You're having fun.... you just don't know it. This programming stuff is frustrating as all hell but once you get it to work you won't forget it!

    HTH,

    BobK
    Let me know how this works for you.
    Attached Files Attached Files

  6. #6


    Did you find this post helpful? Yes | No

    Smile haveing fun now?????

    thanks for takeing your time with me i was able toget your program running

    i have different lcdout commands but was a simple fix


    will continue to try to devolpe

    boy are we haveing fun now next lets go out and shoot off our toes (ha ha)


    thanks again

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


    Did you find this post helpful? Yes | No

    Smile

    Hi Jack,

    Glad to hear you got it working!

    My big thing now is to get the serial LCD module from Wulden.org to work. It displays the data but you can't control where it's suppose to be. It's based on the PHAnderson "chip" and has sometype of ASCII command set that is different from the other adaptors out there.

    I use an RTC in almost everything I build. This forum has been a big help for me.

    Have a nice day!

    BobK

  8. #8


    Did you find this post helpful? Yes | No

    Default where to buy

    where is there a usa dist for this?

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


    Did you find this post helpful? Yes | No

    Smile

    Hi Jack,

    What are you looking to buy?

    BobK

  10. #10


    Did you find this post helpful? Yes | No

    Default serial

    just trying to find a good clock setup thought the serial lcd driver
    would help

    also clock is gaining time have to see where to get the correct crystals for this
    oops clock is loseing time greatly
    any info

Similar Threads

  1. 1307 RTC accuracy?
    By amgen in forum General
    Replies: 16
    Last Post: - 6th October 2008, 19:03
  2. Need help PIC 18F2550 with DS 1302
    By christina86 in forum mel PIC BASIC
    Replies: 1
    Last Post: - 28th December 2007, 02:05
  3. ds 1307
    By jcleaver in forum mel PIC BASIC
    Replies: 2
    Last Post: - 30th June 2007, 13:28
  4. ds 1307
    By jcleaver in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 5th February 2007, 17:09
  5. DS 1620 Code example?
    By G-R-C in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 27th September 2006, 03:45

Members who have read this thread : 2

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