EngineersGarage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise
You are here: Home / Topics / Give me Hex to decimal & decimal to ascii conversion

Give me Hex to decimal & decimal to ascii conversion

|

Microcontroller › 8051 › Give me Hex to decimal & decimal to ascii conversion

  • This topic has 2 replies, 3 voices, and was last updated 8 years, 6 months ago by Ashutosh Bhatt.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • June 13, 2011 at 5:43 am #1001
    Kunal
    Participant

    Hello friends,

    I m very much trouble to find out the conversion of HEX to DECIMAL and DECIMAL to ASCII, in asm programing.

    will u please help me to make both conversion???

    i must need both conversion separatly.

    please help me.. thanx  in advace..:-)

    December 13, 2016 at 11:15 am #14271
    GANEEV SINGH
    Participant

    Hi Kunal

    Firstly, I would like to correct you on the DECIMAL to ASCII conversion part, both of them are same stuff; ASCII is represented in decimals only. Now for the HEX to DECIMAL part, multiply each hexadecimal digit with (2^(4*pos)) where "pos" is the position of that particulat digit counting from right side with rightmost position marked zero '0'. For example:

    if 0xAB45 is to be converted into decimal then its decimal equivalent would be calculated somewhat like this-

    5*(2^(4*0)) + 4*(2^(4*1)) + 11*(2^(4*2)) + 10*(2^(4*3))= 43845

    Hope this helps :)

    December 22, 2016 at 7:21 pm #14291
    Ashutosh Bhatt
    Participant

    if u want in asm programming then its very easy

    1) saparate upper and lower nibble of HEX data using masking

    2) shift upper nibble to right by 4 position

    3) multiply uppper nibble data by 16

    4) add the result with lower nibble

    here is HEX to decimal conversion is complete

    5) now again saparate upper and lower nibbles

    6) add 30h (or 48d) in both nibbles to get ASCII values

  • Author
    Posts
Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
Log In

RSS Recent Posts

  • Epson crystal oscillators June 25, 2025
  • Adhesive Defibrillator Pad Cable June 25, 2025
  • Simple LED Analog Clock Idea June 24, 2025
  • Fun with AI and swordfish basic June 24, 2025
  • Microinverters and storeage batteries? June 23, 2025

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2025 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise