EEProm Data Conversion


Closed Thread
Results 1 to 2 of 2

Hybrid View

  1. #1

    Default EEProm Data Conversion

    Hi,

    I have a little Conversion Problem,I have 6 Data Bytes they are Hour,Minute,Seconds,Day,Month and Year in HEX Format,but I want to Write on the EEprom all in Decimal Data.

    But thi don't work I2CWrite sda,scl,%10100000,Count_Bytes,[DEC Hour,............

    What I can use to Convert to Decimal without a big amount of Code?!

    Thanks a lot for any Answer.

    Regards Pesti.

  2. #2
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default

    This is what I use.


    Code:
    Loop:
    
        GOSUB ReadClk       ' Go read clock from DS1302.
        DataA = RTCmin      ' Load input variable DataA; DataA is now HEX.
        GOSUB SubConvert    ' Go convert HEX to DEC.
        RTCMin = DataA      ' GetBack the Loaded variable. DataA is now Decimal.
    
    '...other stuff here....
    
    Goto Loop
        
        
        SubConvert:
        LOOKDOWN DataA,[0,1,2,3,4,5,6,7,8,9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$30,$31,$32,$33,$34,$35,$36,$37,$38,$39,$40,$41,$42,$43,$44,$45,$46,$47,$48,$49,$50,$51,$52,$53,$54,$55,$56,$57,$58,$59],DataA
        RETURN
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

Similar Threads

  1. Data EEPROM gets clobbered during programming
    By BrianT in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 18th July 2008, 02:46
  2. Big characters on HD44780 4x20
    By erpalma in forum mel PIC BASIC Pro
    Replies: 23
    Last Post: - 7th January 2007, 02:21
  3. LCD + bar graph
    By DynamoBen in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 5th October 2005, 14:50
  4. Internal EEPROM Read/write Addressing Errors with 18F PIC's
    By Melanie in forum FAQ - Frequently Asked Questions
    Replies: 18
    Last Post: - 12th July 2005, 19:42
  5. Sinus calculating !
    By Don Mario in forum mel PIC BASIC Pro
    Replies: 29
    Last Post: - 28th November 2004, 23: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