UberNewbie can't set his clock...


Closed Thread
Results 1 to 20 of 20

Hybrid View

  1. #1
    Join Date
    Jan 2009
    Location
    California, USA
    Posts
    323


    Did you find this post helpful? Yes | No

    Default

    Thank you sinoteq !

    I tried the code without the $ in front of the variables, and using DEC2 instead of HEX2 in the LCDOUT command as you suggested, and now the button to set the time works fine. BUT, the time no longer displays correctly.

    Now it skips certain numbers (groups of 6 it seems) as it goes from 0 to 60, and it counts to 90 instead of 60 before it increments the minute and resets seconds to 0...

    So now the time "increment minutes" button goes from 0 to 60 then resets as is desired, but the time displayed from the RTC goes to 90 seconds and skips numbers.

    I'm open for more suggestions!

    Thanks,
    Steve

  2. #2
    sinoteq's Avatar
    sinoteq Guest


    Did you find this post helpful? Yes | No

    Default Ds1302

    If you look at the datasheet for the DS you will se that you have to do some formating of the DS result before you can display it. The DS does not store each SEC MIN HOUR and so on as a byte, it is stored in a mixed byte (I bet Melanie knows the correct word for it)

    Example:
    The register for seconds is 8 bits wide but is split into a 10 SEC part and a SEC part. So you have to look at the DS data as (n*10SEC)+SEC.
    You have to move this into a byte before you can display it. I have never used DS1302 but I have used the DS1307 and the idea is similar.

    Please look at http://pdfserv.maxim-ic.com/en/ds/DS1302.pdf Table 3 page 9

  3. #3
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    (I bet Melanie knows the correct word for it)

    Melanie has all kinds of words for all kinds of situations... but in this instance I'll chose to use BCD (Binary Coded Decimal)...

Similar Threads

  1. Interruptus Frustratus
    By Byte_Butcher in forum General
    Replies: 16
    Last Post: - 17th April 2009, 20:36
  2. 16F628A - Stops if release power switch.
    By dene12 in forum General
    Replies: 16
    Last Post: - 14th February 2009, 07:57
  3. Help with sound command in 2 programs
    By hyperboarder in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 5th July 2007, 20:36
  4. error on compiling
    By parker in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 16th June 2005, 14:31
  5. How to set external clock source in PBP
    By TurboLS in forum mel PIC BASIC Pro
    Replies: 28
    Last Post: - 19th February 2005, 15:56

Members who have read this thread : 0

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