DS1302 16F628 Woes


Closed Thread
Results 1 to 5 of 5

Hybrid View

  1. #1
    Join Date
    Apr 2005
    Location
    Virginia
    Posts
    65


    Did you find this post helpful? Yes | No

    Default

    idtat,

    I'm attempting to use the DS1302 myself with luck as well. Now, I haven't read through your code to any great extend, but one thing jumped out at me:

    Code:
    w_in:
    mem = reg_adr ' Set mem variable to reg_adr contents
    high rst ' Activate the DS1302
    shiftout dq,clk,0, [mem] ' Send control byte
    shiftin dq,clk,1, [mem] ' Retrieve data in from the DS1302
    low rst ' Deactivate DS1302
    return
    I'm assuming you're using burst mode? Regardless, in either burst mode or the non-burst mode, you have to use LSB. I see you did that for your shiftouts, but not for your shiftin above. In other words, try changing this:

    Code:
    shiftin dq,clk,1, [mem] ' Retrieve data in from the DS1302
    to this:

    Code:
    shiftin dq,clk,0, [mem] ' Retrieve data in from the DS1302
    Let me know if you have luck. I'm trying to read seconds and I'm getting junk.

  2. #2
    Join Date
    Apr 2005
    Location
    Virginia
    Posts
    65


    Did you find this post helpful? Yes | No

    Default

    Okay, I'm an idiot. I didn't realize a '1' in shiftin is for LSB, whereas a '1' in shiftout is MSB. I came across some other code (haven't tried it yet) on the forum that may help:

    http://www.picbasic.co.uk/forum/show...ghlight=ds1302


    Good luck.

Similar Threads

  1. real time clock
    By maria in forum Code Examples
    Replies: 44
    Last Post: - 1st March 2022, 13:13
  2. LCDOut Woes
    By LetTheSmokeOut in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 11th June 2008, 02:45
  3. Ds1302 Stops are runs slow
    By Kman in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 13th June 2006, 03:10
  4. SERIN2 not working with 16F628
    By d1camero in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 6th May 2004, 21:37
  5. 16F628 on-chip eeprom problem
    By atomski in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 4th March 2004, 08:43

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