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 / Replies /  you need ascii character to

 you need ascii character to

|

Microcontroller › 8051 › I need help to understand programe in digital clock using LCD. ›  you need ascii character to

May 16, 2011 at 2:24 am #6208
romel emperado
Participant

 

you need ascii character to display in LCD so here’s the trick of that program.

 

example you want to display 23 in LCD then we will store that 23 in a variable

 

int c = 23;

 

c = c/10;   // c now is = 2 since we are deviding integer numbers.

 

c= c+48;  // now we add 48 to convert it to ascii character and ready to display in LCD.. 2+48 =50. 50 is the ascii equivalent  of number 2..

 

then do the same for the other number

 

c = c%10;   // c now is e = 3 since we se modulo operation.

c= c+48;  // now we add 48 to convert it to ascii character and ready to display in LCD.. 3+48 =51. 51 is the ascii equivalent  of number 3

 

and after that operation you are ready to display 23 in the LCD.  :)

 

 

lcd_cmd(0xc3); // this is simply for the location of the lcd


if 0xCx meaning 2nd row and the value of x is anything not more than 16 since we have 2x16 LCD

when we have 0x8x meaning 1st row and the value of x is lcd
anything not more than 16 since we have 2x16



i hope you got it.. ")

 

RSS Recent Posts

  • Wish to buy Battery, Charger and Buck converter for 12V , 2A router May 13, 2025
  • Electronic Components May 13, 2025
  • Need Help Figuring Out the Schematics Of Circuit Board May 13, 2025
  • applying solder paste from a jar May 12, 2025
  • Question i-nears headphones magnetic drivers May 12, 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