Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

displaying characters on LCD !

Status
Not open for further replies.

Peter Nabil

New Member
Hi every one
I have a LCD 16x2 and I wrote a simple program to display characters on it using MC AT89c51, I sent the characters from RAM as hexadecimal code , then the LCD displayed undefined letters, so my question is how can I put an ASCII character in the RAM ?? Is it possible??
If not, please someone give me the converter table from hexa to ASCII
Thanks for your help
 
I think that you have to get the data sheet for the LCD , and see what codes it is expecting to recieve for a given character..
 
I can't help you on Atmel code, though there's PIC code in my tutorials - but HEX to ASCII is very trivial to do! - and the LCD modules use fairly standard ASCII (at least for the common letters and numbers).
 
williB said:
I think that you have to get the data sheet for the LCD , and see what codes it is expecting to recieve for a given character..

It has nothing to do with the LCD.

For example, if you want to display a byte value of 0x68 on the LCD, then you have to send 0x36 and 0x38 to the LCD. These are the ASCII value of "6" and "8" repectively. The first would display as 6 on the display while the last byte would display as 8. So you get 68 displayed.

Another example: to display 0xCD, you need to send 0x43 and then 0x44.

To display a single character "C", just send 0x43 to LCD.

Search for ASCII table on the net.
 
It has something to do with the LCD , because its NOT working ,is it.?
Maybe his timing signals are wrong , and where would a person go to find the problem . In the data sheet..
 
If you're talking about Character-Generation, I'd double-check that you are setting the proper CG RAM addresses when you upload your character bitmaps. Also make sure you write/read the bitmap immidiatly after you set this address (not including the execution delay) or you custom character may be ignored. Regular characters are working right?
 
eblc1388 said:
williB said:
I think that you have to get the data sheet for the LCD , and see what codes it is expecting to recieve for a given character..

It has nothing to do with the LCD.

For example, if you want to display a byte value of 0x68 on the LCD, then you have to send 0x36 and 0x38 to the LCD. These are the ASCII value of "6" and "8" repectively. The first would display as 6 on the display while the last byte would display as 8. So you get 68 displayed.

Another example: to display 0xCD, you need to send 0x43 and then 0x44.

To display a single character "C", just send 0x43 to LCD.

Search for ASCII table on the net.

Hey eblc1338
actually , i wrote your program, and it didn't work!!!
i really don't know why ?
i bought another LCD to test on it , it gave me another anonymous character!
i am pretty sure the lcd is working well, and all the connections are right,
it displays the characters so well when i sent it ,
i thought the problem was from the MC RAM so i tried another MC, the same result too !

here is the program for your example, see it yourself
:(
ORG 0H ;
Mov A, #38 H ; Init LCD 2 lines, 5*7 Matrix
LCALL Command ; Issue command
Mov A, #0E H ; LCD on, cursor on
LCALL Command ; issue command
Mov A, #01 H ; Clear LCD command
LCALL Command ; issue command
Mov A, #06 H ; Shift cursor right
LCALL Command ; issue command
Mov A, #80 H ; Force cursor at the beginning of the 1st
LCALL Command ; issue command
Mov A, # 36H
Mov 30H, A
Mov A, # 38H
Mov 31H,A
Mov R0, 30H ; RAM pointer
Mov A,@R0
ACALL Romeo
INC R0
Mov A,@R0
ACALL Romeo
SJMP End


Command: ACALL Ready
Mov P1, A
CLR P2.5
CLR P2.6
SETB P2.7
CLR P2.7
RET

Romeo: ACALL Ready
Mov P1, A
SETB P2.5
CLR P2.6
SETB P2.7
CLR P2.7
RET

Ready: SETB P1.7
CLR P2.5
SETB P2.6
Back: CLR P2.7
SETB P2.7
JB P1.7, Back
RET

End:sjmp End
 
Code:
Mov A, # 36H
Mov 30H, A
Mov A, # 38H
Mov 31H,A

Mov R0, 30H                    ; RAM pointer
       ^^^^^

Mov A,@R0
ACALL Romeo
INC R0 
Mov A,@R0
ACALL Romeo
SJMP End

I must remember to use #30H and not 30H !!!!!!
I must remember to use #30H and not 30H !!!!!!
I must remember to use #30H and not 30H !!!!!!
I must remember to use #30H and not 30H !!!!!!
I must remember to use #30H and not 30H !!!!!!
I must remember to use #30H and not 30H !!!!!!
I must remember to use #30H and not 30H !!!!!!
I must remember to use #30H and not 30H !!!!!!
 
OH WOWWWWWWWWW
i can't believe myself,
thanks a million eblc1388 ,
thanks Man,
you really had to be an Electronics God not, Electronics expert
thanks again, :wink:
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top