Conversion Problem


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

    Default Conversion Problem

    Hi,

    I have a little conversion Problem.

    I have this:

    ProjektSum var byte
    Projeknumber var byte
    LoopProjekt:
    HSerin 30000,LoopProjekt,[Projeknumber[0],Projeknumber[1],Projeknumber[2],Projeknumber[3],Projeknumber[4],Projeknumber[5]]

    My Input ist for example :9 5 0 6 6 2

    then I have this:

    'ProjektSum[0]= ((Projeknumber[0] - $30) * $A) + (Projeknumber[1] - $30)
    'ProjektSum[1]= ((Projeknumber[2] - $30) * $A) + (Projeknumber[3] - $30)
    'ProjektSum[2]= ((Projeknumber[4] - $30) * $A) + (Projeknumber[5] - $30)

    I2CWrite sda,scl,%10100000,$F0,[ProjektSum[0],ProjektSum[1],ProjektSum[2]]

    I want to write the first Byte as 95 the Seond one as 06 end the third as 62 but as decimal.My Problem is that the Number 65 was written as 5F and the third as 3E.
    My question is how can I write this number in the EEprom as decimal.

    Thank you very much for any Help.

    Regard Pesti.

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,521


    Did you find this post helpful? Yes | No

    Default

    Hi,
    I'm not sure I understand the problem here. It's not a matter of how it's stored. It's a matter of how you display it when you retrieve it from the EEPROM. You say that the value 62 is stored as 3E but 3Ehex IS 62dec.

    Sorry If I misunderstood the question.

    /Henrik Olsson.

  3. #3


    Did you find this post helpful? Yes | No

    Default

    Hi,
    Thanks for your interest.

    I must to write my input 1:1 to my Eeprom Data example:

    Hyperterminal Input : 9 5 0 6 6 2

    EEprom Data : 95 06 62 ..........

    I make a mistake i dont need decimal ,I think I must store this as hex 95,hex 06,hex 62 but idont know how i can convert this

    Regard Pesti
    Last edited by Pesticida; - 18th March 2007 at 10:42.

  4. #4
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Hi Pesti,

    Try this..
    Code:
    ProjektSum var byte[3]
    
    LoopProjekt:
    HSerin 30000,LoopProjekt,[HEX2 ProjektSum(0),HEX2 ProjektSum(1),HEX2 ProjektSum(2)]
     
    I2CWrite sda,scl,%10100000,$F0,[ProjektSum(0),ProjektSum(1),ProjektSum(2)]
    DT

  5. #5


    Did you find this post helpful? Yes | No

    Default

    Hi,
    Thank You very much! Taylor
    :-) one little change and a so great solution.
    Super.

    Regard Pesti

Similar Threads

  1. 16F627A to 16F88 conversion problem
    By PICpocket in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 18th February 2009, 19:20
  2. A/D conversion problem in 18F2520, 2523, 2550 etc.
    By selimkara in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 10th March 2008, 16:26
  3. A/D conversion problem on 18F4431
    By ttease in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 10th April 2007, 23:03
  4. Conversion problem
    By eva in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 15th March 2007, 18:21
  5. A/D conversion problem with pic16F88
    By Tapio Linkosalo in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 18th August 2006, 11:42

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