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