This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

LCD display of no. greater then 256

I m facing a problem that i want to display numbers greater then 256 and up to 99999 on LCD.i need some code help to understand it
peace

Parents
  • I'd guess the problem lies in understanding how to convert a multi-byte integer to the LCD format. It sounds like Omar can convert single bytes and display them.

    If efficiency isn't a concern, the easiest thing to do is simply use a wider integer type -- 16 bits would hold five decimal digits, but to get to 99,999 you'll need a 32-bit long -- and either repeatedly divide by 10 (least significant digit first) or start with a divisor of 10,000 and divide the divisor by 10 on each pass (most significant digit first).

    If the LCD takes ASCII input, just use sprintf().

Reply
  • I'd guess the problem lies in understanding how to convert a multi-byte integer to the LCD format. It sounds like Omar can convert single bytes and display them.

    If efficiency isn't a concern, the easiest thing to do is simply use a wider integer type -- 16 bits would hold five decimal digits, but to get to 99,999 you'll need a 32-bit long -- and either repeatedly divide by 10 (least significant digit first) or start with a divisor of 10,000 and divide the divisor by 10 on each pass (most significant digit first).

    If the LCD takes ASCII input, just use sprintf().

Children
No data