| ??? 03/06/03 17:16 Read: times |
#40929 - RE: This is how to backspace Responding to: ???'s previous message |
Johnatan:
I am going to presume that your display is a character mode display. You say that you have it aleady working for displaying strings and such. So what you are having difficulty doing is controllng the location of the cursor. With these type displays there is a kind of a defacto standard controller chip used. The originator of this chip was Hitachi with their HD77480 chip. In the times since then many many vendors have made clones of this chip for use on character mode LCD modules. I am also going to not be specific about the actual command codes becasue you can find those in tbe data sheet for the controller part. Interfacing to this chip is a process of writing to either a Data Register or a Command register. When you output to the Data register the data you output is written into the display data memory in the controller. Each memory location corresponds to a location of the screen. On board the part there is a register that holds the current display memory address. Writing to the data resister casues the written byte to be placed into the memory at the position of this "current display address". If you have used the "typical" initialization for the controller chip, then each time you write a byte into display data memory via the data register this current display memory address is incremented. This makes it convenient for you when you want to output a string like "ABCD" that you just send A then B then C then D and they line up left to right on the display screen. Now for when you want the next character to be output it is not always that you want it to come right acter the last byte that was written. For this purpose there is a command byte that you can send to the controller via the control register that will let you specify the value that is strored in the current display memory address register. So lets say that from the previous example you wanted to display "abcd" in place of the ABCD from before it is first necessary to move the current display memory address pointer to the place where the A is stored in the display memory. They you are free to output "a" then "b" and "c" and "d". When you say that you want to support a back space concept on the LCD controller it usually seems like the code you are writing is a user data entry field that you are displaying character by character as it is entered by the user. In case the user made a mistake you naturally want to simply have a back space key cause the last entered character to be erased. Unfortunately the LCD controller does not directly support this type of operation. So when your edit code is in operation you want to change your design concept a bit. As the characters are entered by the user then but them into a buffer as a string. If you see that a mistake has been made and the user does the back space key then you simply have to erase the last entry in your string buffer and make it one shorter. What you do at the display under these conditions is to repositon the current dsplay memory register value back to the location that corresonds to the location of the start of the string. Then you re-display the string. At then end of the string you will check if the dispayed string was shorter then the full space of the edit field on the LCD screen and you would output an appropriate number of SPACE characters to blank out the rest of the field. If you have followed this discussion then it will start to become obvious that all you ever need for controlling an LCD text content is a routine to set the current display location and one to output a character to that location and know that when the character is outputted the current display location will move forward one position. So break up your display layout into fields and display the whole field ehrn there is a change to the in memory data that represents what is currently on the screen. I hope this answers your question. I know this is written a little rough butyou will have to forgive me for that. Michael Karas |
| Topic | Author | Date |
| How Can I execute a Backspace on LCD? | 01/01/70 00:00 | |
| RE: How Can I execute a Backspace on LCD | 01/01/70 00:00 | |
| How Can I move the cursor back? | 01/01/70 00:00 | |
| RE: How Can I execute a Backspace on LCD | 01/01/70 00:00 | |
| This is how to backspace | 01/01/70 00:00 | |
| RE: This is how to backspace | 01/01/70 00:00 | |
| RE: This is how to backspace | 01/01/70 00:00 | |
| RE: This is how to backspace | 01/01/70 00:00 | |
RE: This is how to backspace | 01/01/70 00:00 | |
| RE: How Can I execute a Backspace on LCD? | 01/01/70 00:00 |



