Hex to Binary Conversion


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2003
    Location
    Australia
    Posts
    257

    Default Hex to Binary Conversion

    Hi want some help with this.

    If store a Byte, (say "A") into the internal eerom, it is stored as 41(Hex value)

    Now I want to work on this value bit wise.

    I know that the value of "A" = 10 (Decimal )or %1010 (binary).....

    But reading it back in has the value of "%01000001".

    Why is this? and how can I convert $A to %1010?

    I guess what I am trying to do is convert 7bit ascii to 4 bitascii.. But I could be wrong.

    Cheers
    J

    ###########

    Ok I figured it out just after posting! Always the way. I was saving the letter "A" as an ascii char rather than a Hex Char
    Last edited by Squibcakes; - 5th September 2006 at 04:30.

  2. #2
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default

    Squibcakes , The Ascii value of "A" equals hex 41 but the value of 10 decimal equals "A" hex. Do you want to convert the ascii value of "a" to hex?

    Dave Purola,
    N8NTA

  3. #3
    Join Date
    Oct 2004
    Location
    Hangover, Germany
    Posts
    289


    Did you find this post helpful? Yes | No

    Default

    OK,

    if you don't convert the value into hexadecimal ASCII-Characters before writing them to EEPROM, you read them back as usual binary value.

    If you convert it to ASCII before writing you must convert it back after reading !

    Easy:
    Don't translate it to chinese if you don't want to read Chinese !
    PBP 2.50C, MCS+ 3.0.0.5, MPLAB 8, MPASM 5.14, ASIX Presto, PoScope, mE mikroBasic V7.2, PICKIT2

Similar Threads

  1. Conversion from picbasic pro to hex for mplab
    By pr2don in forum Forum Requests
    Replies: 5
    Last Post: - 10th October 2010, 19:53
  2. PIC16F877A pwm use for IR transmission
    By mcbeasleyjr in forum General
    Replies: 0
    Last Post: - 11th July 2009, 18:51
  3. Decimal to Binary Conversion
    By schlaray in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 23rd December 2006, 14:58
  4. Decimal to binary conversion
    By Demon in forum Code Examples
    Replies: 9
    Last Post: - 25th February 2005, 20:05
  5. HEX to BCD conversion
    By Don Mario in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 2nd February 2005, 14:39

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