element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Experts, Learning and Guidance
  • Technologies
  • More
Experts, Learning and Guidance
Ask an Expert Forum Tool to convert decimal to ascii.
  • Blog
  • Forum
  • Documents
  • Leaderboard
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Experts, Learning and Guidance to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 5 replies
  • Subscribers 278 subscribers
  • Views 1830 views
  • Users 0 members are here
  • decimal
  • ascii
Related
See a helpful answer?

Be sure to click 'more' and select 'suggest as answer'!

If you're the thread creator, be sure to click 'more' then 'Verify as Answer'!

Tool to convert decimal to ascii.

Alxender
Alxender over 2 years ago

I'm here to consult with you all. i wanna ask which tool is best to convert decimal to ascii. I'm also searching on it. Give your suggestion. if i would find a suitable tool, i will also share with you.

  • Sign in to reply
  • Cancel

Top Replies

  • dougw
    dougw over 2 years ago +3
    https://onlineasciitools.com/convert-decimal-to-ascii https://www.calculators.tech/decimal-to-ascii
  • colporteur
    colporteur over 2 years ago +2
    What is your application for the software tool? Embedded in program or stand alone?
  • KennyMillar
    KennyMillar over 2 years ago +2
    float f; f = 123.45 printf("%f",f);
  • Gough Lui
    Gough Lui over 2 years ago

    If you use C, it's as simple as storing the decimal number into a uint8_t and then printing it out as a char.

    Some calculators can do it ... there are also websites that will do the same with a quick Google search although I will refrain from recommending any particular one to avoid being flagged as spam.

    - Gough

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • michaelkellett
    michaelkellett over 2 years ago

    Here's a code snippet in VHDL, I doubt that it's quite what you are after (it converts binary to ascii) but it gives an idea of the range of valid answers.

    Is it the best tool - of course not, but it's good where it's used.

    					when PAR_READ =>
    						reg_rd <= '1';
    						pars_state <= PAR_READ_1; 
    					when PAR_READ_1 =>
    						if reg_trf_done = '1' then
    							v_reg := unsigned(reg_in);						 	 
    							if (v_reg(31) = '1') and ((cmnd_char = x"6a") 				-- reg a is 32 bit signed so deal with -ve case 
    													or (cmnd_char = x"67") 				-- reg g is interleave accumulator 
    													or (cmnd_char = x"71") 				-- reg q is pos_count1 
    													or (cmnd_char = x"72") 				-- reg r is pos_count2 
    													or (cmnd_char = x"73") 				-- reg s is pos_count3
    													) then
    								v_reg(31) := '0';
    								v_reg(30 downto 0) := ((not v_reg(30 downto 0)) + "0000000000000000000000000000001");  
    								isneg <= '1';
    								tx_char <= "00101101";			-- negative sign
    								tx_wrreq <= '1'; 				-- send it out					
    							else
    								isneg <= '0';
    							end if;								
    							reg_val <= v_reg;
    							reg_rd <= '0'; 
    							ten_pwrs_index <= "1001";		-- points to 1e9	  
    							digit <= "0000";  
    							nz_sent <= '0';					-- used to prevent leading zeros, set when a character is sent
    							pars_state <= PAR_READ_1A; 
    						end if;	 
    					when PAR_READ_1A =>
    						tx_wrreq <= '0';					-- must be cleared after -ve so clear anyway is safe
    						pars_state <= PAR_READ_2;
    					when PAR_READ_2 => 
    						if reg_val >= ten_pwrs(to_integer(ten_pwrs_index)) then
    							reg_val <= reg_val - ten_pwrs(to_integer(ten_pwrs_index));
    							digit <= digit + 1;
    						else
    							if (digit > 0) or (nz_sent = '1') or (ten_pwrs_index = 0) then
    								tx_char <= std_logic_vector(("0000" & digit) + 48);  
    								tx_wrreq <= '1';  
    								nz_sent <= '1';
    								pars_state <= PAR_READ_3; 
    							end if;
    							ten_pwrs_index <= ten_pwrs_index - 1;	-- when ls digit will wrap to 15
    						end if;
    					when PAR_READ_3 =>
    						tx_wrreq <= '0';		
    						if ten_pwrs_index < 10 then					-- traps the end condition	
    							digit <= "0000";
    							pars_state <= PAR_READ_2; 
    						else
    							pars_state <= PAR_SEND_CRLF;	
    						end if;	
    					when PAR_SEND_CRLF =>
    						tx_char <= "00001101";						-- CR
    						tx_wrreq <= '1'; 					
    						pars_state <= PAR_CRLF_1;
    					when PAR_CRLF_1 =>
    						tx_char <= "00001010";						-- LF
    						tx_wrreq <= '1'; 					
    						pars_state <= PAR_CRLF_2;
    					when PAR_CRLF_2 =>
    						tx_wrreq <= '0'; 
    						busy <= '0';
    						pars_state <= PAR_IDLE;
    

    So, first of all what do you mean by decimal - this is what I call decimal 4567 - a number represented by tokens for values 0 - 9, but I suspect you mean a numeric value in some code that you want to output as ASCII characters.

    If you define the problem better it will be possible to give some answers.

    MK

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • colporteur
    colporteur over 2 years ago

    What is your application for the software tool? Embedded in program or stand alone?

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Cancel
  • KennyMillar
    KennyMillar over 2 years ago

    float f;

    f = 123.45

    printf("%f",f);

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Cancel
  • dougw
    dougw over 2 years ago

    https://onlineasciitools.com/convert-decimal-to-ascii

    https://www.calculators.tech/decimal-to-ascii

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube