Hope someone can help... if possible.
I need to read a byte from EEprom and display the equivalent ASCII characters on a LCD.
EG: Stored in EEprom, ABCDEFGHIJKLMNOP (16 chars),stored as hex values.
I read the values from EEprom addresses OK and store them in Bytes.
I then use the ByteToStr function to what I would expect to convert these values to the string representations of the byte value.
When I display these converted values on the LCD, I get the decimal values displayed!?
Example, 0x4C in EEprom gets displayed as 76.
I have 'played' with various ideas, Ord(), Chr(), altering the variables to store the data between array and string etc., but still no luck.
Hopefully I have explained accurately what I am attempting to achieve - HELP
Text onto LCD display
-
- Posts: 68
- Joined: 12 Apr 2006 11:55
- Location: Gold Coast Australia
- Contact:
Text onto LCD display
DISCLAIMER: Content reflects the thoughts & opinions of my goldfish neighbour's mad dog; don't quote me on that; don't quote me on anything; hand wash only, tumble dry on low heat; do not bend or fold.
Re: Text onto LCD display
What do you mean when you write "stored as hex values"? Do you use two bytes for each character?
ByteToStr will output the numerical representation of the byte.
Assuming your bytes are already in the valid ascii-range, like your example 0x4C, you can just use Lcd_Chr.
ByteToStr will output the numerical representation of the byte.
Assuming your bytes are already in the valid ascii-range, like your example 0x4C, you can just use Lcd_Chr.
Re: Text onto LCD display
Formally, when storing chars in EEPROM and then reading and sending them to LCD one indeed should use these functionslewjoubert wrote:I have 'played' with various ideas, Ord(), Chr()...
Code: Select all
var ch:char;
EEPROM_Write(addr, ord(ch));
...
ch:=chr(EEPROM_Read(addr));
Lcd_Chr(row, column, ord(ch));
-
- Posts: 68
- Joined: 12 Apr 2006 11:55
- Location: Gold Coast Australia
- Contact:
Re: Text onto LCD display
Thanks for assistance Jani, problem solved.
Ended up with this (skeleton code):-
NOTE: 2 Line 16 character LCD
var
w1-16, z1-16 : char;
txt2:string[16];
....
z1-16 := EEPROM_Read(addresses 1- 16);
w1-16:= ord(z1-16);
txt2 := chr(w1)+chr(w2)+chr(w3)...+chr(w16)
LCD_Out(2,1,' ');
LCD_Out(2,1,txt2);
Ended up with this (skeleton code):-
NOTE: 2 Line 16 character LCD
var
w1-16, z1-16 : char;
txt2:string[16];
....
z1-16 := EEPROM_Read(addresses 1- 16);
w1-16:= ord(z1-16);
txt2 := chr(w1)+chr(w2)+chr(w3)...+chr(w16)
LCD_Out(2,1,' ');
LCD_Out(2,1,txt2);
DISCLAIMER: Content reflects the thoughts & opinions of my goldfish neighbour's mad dog; don't quote me on that; don't quote me on anything; hand wash only, tumble dry on low heat; do not bend or fold.