Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
Thread Tools Display Modes
Old 23rd April 2004, 09:12 AM   (permalink)
Experienced Member
patricktran is on a distinguished road
Default Lookup table for LCD and 7 segment display

Hi ,
Ive read somewhere about how to output data from a MCU to LCD or 7 seg display as follow:
The data from MCU normally is in hex, we convert it into BCD (so that each digit is represented as 4 binary), and this BCD is used to index off the look up table to LCD or 7 seg.
The table is like follow: (Blank, 0-9)
TABLE FCB $7E, $30, $6D, $79, $33, $5B, $5F, $70, $7F, $73, $00
END

How these hex number can be used to display in LCD? I ve checked the ASCII table, cant find anyone of them fits.
Also, is the table for LCD and 7 seg different?
How we can move along the table? Is table recommended?
Thanks
patricktran is offline   Reply With Quote
Old 23rd April 2004, 10:40 AM   (permalink)
Super Moderator
 
Nigel Goodwin is a splendid one to beholdNigel Goodwin is a splendid one to beholdNigel Goodwin is a splendid one to beholdNigel Goodwin is a splendid one to beholdNigel Goodwin is a splendid one to beholdNigel Goodwin is a splendid one to behold
Default Re: Lookup table for LCD and 7 segment display

Quote:
Originally Posted by patricktran
Hi ,
Ive read somewhere about how to output data from a MCU to LCD or 7 seg display as follow:
The data from MCU normally is in hex, we convert it into BCD (so that each digit is represented as 4 binary), and this BCD is used to index off the look up table to LCD or 7 seg.
The table is like follow: (Blank, 0-9)
TABLE FCB $7E, $30, $6D, $79, $33, $5B, $5F, $70, $7F, $73, $00
END
First off you are making a very common mistake, it's not BCD you're concerned with - it's simply decimal. BCD is a method of storing two decimal digits in a single byte.

What you need to do is convert the binary number to it's decimal equivilent - if you look at some of my tutorials (the Analogue input one is one which does it) they include a routine called 'Convert'. This routine (which I downloaded from the PICList) takes a two byte binary number (NumL and NumH) and converts it to five decimal digits - ones, tens etc.

I then print it on the LCD using a routine called 'LCD_CharD' which converts the digit to ASCII and prints it on the LCD.

My 7 segment LED tutorial shows how to use a table to drive a 7 segment LED.

Quote:
How these hex number can be used to display in LCD? I ve checked the ASCII table, cant find anyone of them fits.
Also, is the table for LCD and 7 seg different?
How we can move along the table? Is table recommended?
You don't need a table for LCD, just convert the decimal digits to ASCII.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is online now   Reply With Quote
Old 23rd April 2004, 01:09 PM   (permalink)
Experienced Member
patricktran is on a distinguished road
Default

Oh, let me sumaries it.
So with LCD: we convert binary to decimal -> pass it into LCD driver
with 7 seg display: binary to lookup table of 7 seg codes
Please correct me if I am wrong.
Thanks
PS: I will read more the tut.
patricktran is offline   Reply With Quote
Old 23rd April 2004, 01:43 PM   (permalink)
Super Moderator
 
Nigel Goodwin is a splendid one to beholdNigel Goodwin is a splendid one to beholdNigel Goodwin is a splendid one to beholdNigel Goodwin is a splendid one to beholdNigel Goodwin is a splendid one to beholdNigel Goodwin is a splendid one to behold
Default

Quote:
Originally Posted by patricktran
Oh, let me sumaries it.
So with LCD: we convert binary to decimal -> pass it into LCD driver
with 7 seg display: binary to lookup table of 7 seg codes
Please correct me if I am wrong.
Thanks
PS: I will read more the tut.
You need to convert for the 7 segment as well, but for the LCD you then add 0x30 to it to change it to ASCII. For the 7 segment you use the decimal digit as an index into the table to get the correct bit pattern to display the number.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is online now   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes




All times are GMT. The time now is 10:40 AM.


Electronic Circuits  |  Radio Controlled
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.