ds 1307


Closed Thread
Results 1 to 15 of 15

Thread: ds 1307

  1. #1

    Question ds 1307

    having trouble finding post useing thgis dallas clock chip in pic basic pro

    searched under ds 1307 and rtc no listing
    can someone supply thread

    thanks

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    try with ds1307 in one word.

    One nice code example HERE
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  3. #3


    Did you find this post helpful? Yes | No

    Question ds 1307

    great program must have taken a lot of work

    any way to get a schematic diagram or hook up sheet??

  4. #4
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Euh... i don't see why as almost everything is really well explained in the hardware assignment section of the code.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  5. #5


    Did you find this post helpful? Yes | No

    Default hookup

    ok will try that
    one more question trying to use with a 16f877a
    get error messag but compiles

    102 crosses boundry at @800h
    already got protype board for this setup for this chip

    any ideas?

  6. #6
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    http://www.picbasic.co.uk/forum/show...osses+boundary

    It's just a warning, nothing important. If you're using MPASM to compile your code, just add
    Code:
    @    errorlevel -306
    and this will remove this stupid warning.

    And, here's another endorsement
    http://www.picbasic.co.uk/forum/show...02&postcount=1

    At least, i don't feel alone
    Last edited by mister_e; - 3rd February 2007 at 19:23.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  7. #7


    Did you find this post helpful? Yes | No

    Default error

    ok howeve i am not using mpsam
    get lot more errors in program with this

    thanks
    for your help

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


    Did you find this post helpful? Yes | No

    Smile

    Hi jcleaver,

    You could save everyone alot of time and sanity if you would just post, for example, the errors you ARE getting and what compiler and assembler and version levels you are using. Perhaps even a screenshot of the list of errors from your program.

    The program Mister-E referred you to was written for a 16F628. You are using a 16F877A. I apologize if I assume something here but you will have to make a number of setting changes to port over to the 877A. Analog ports on the 877A not on the 628, config fuse settings, etc.

    We can help but give us the data we need!

    BobK

  9. #9


    Did you find this post helpful? Yes | No

    Default more info

    did finally get something to work attached program but for some reason i am unable to duplicate this again seems to be the clock wont start
    using pbp and mcs tried using mpspam with this but too many errors to count if someone could look over this listing and explain why the clock is not starting once itruns which i dont know how i got there it does what i want


    thanks

    ' 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



    I2CWRITE SDA,SCL,CONT,ADDR,[$00,$59,$11,$03,$25, $12 ,$03, $10]
    PAUSE 5000
    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 500
    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

  10. #10


    Did you find this post helpful? Yes | No

    Default values

    noticed all the values min sec ect go to 02 hex regardless of what my inital setting is

  11. #11
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Any Back-Up battery attached to this DS1307?
    Quote Originally Posted by DS 1307 datasheet
    Backup Supply Input for Any Standard 3V Lithium Cell or Other Energy Source. Battery
    voltage must be held between the minimum and maximum limits for proper operation.
    Diodes in series between the battery and the VBAT pin may prevent proper operation. If a
    backup supply is not required, VBAT must be grounded.
    Any Pull-Up on SDA and SCL pins?
    Last edited by mister_e; - 4th February 2007 at 23:03.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

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


    Did you find this post helpful? Yes | No

    Smile

    Hi jcleaver,

    Do you have your RTC variables declared in your program? Look on page 2 or the Project MN1307 program about 1/2 way down.

    Also do you have a statement "RTCSec.7 = 0". You need this to start the clock running. The clock chip powers up with RTCSec.7 = 1 which turns the osc off.

    Your program could be returning the errors if you don't have the clock variables declared. Guessing at this point.

    I see you have several segments to your program. You should take each one step by step. First get your LCD working. Something like a "Hello World". Then get the A/D portion working. Then add the clock program.

    HTH,

    BobK

  13. #13


    Did you find this post helpful? Yes | No

    Default ty

    was the bat conn not grounded appreicate all your help getting this going
    thanks again

  14. #14


    Did you find this post helpful? Yes | No

    Default ?

    that solved the problem of everything going to 02 but the clock is still not running i am sending $00 to secs on inital start up do have pullup on scl and sda so i guess im not as far along as i thought

  15. #15


    Did you find this post helpful? Yes | No

    Default working

    think i got it circuit board problem i hope
    again thanks now i just have to add temp and i got this one done
    let you know

Similar Threads

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

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