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
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

  • Help identify a part August 15, 2022
  • LM3914 Loading down the reference voltage August 15, 2022
  • Prototype for a detector August 15, 2022
  • CE Transistor Amplifier August 15, 2022
  • Drill speed controller fault August 14, 2022

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2022 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