Use backspace of 4x4 keypad and display in 16x2 lcd using pic18f6520

i am interfacing LCD and a 4x4 keypad with PIC18f6520. i wrote the code in embedded C. when ever user press a key, it is displayed on LCD. i made the checks for keypad like this (for printing 1)

row_1 =1;




can some one please help me how i can use backspace function in this case for removing characters on LCD one by one, (just like mobile and keyboard) and also guide me about any library if required for that method.

For example-

pressed key 012345

pressed backspace key - 01234, again-0123 so on.

Thank in Advanced.

You have to have a LCD buffer which gets printed continuously to the LCD. Modify the buffer contents to reflect changes in LCD display.
Monitor each character that is being entered. If ASCII equivalent of backspace is encountered remove the last value in the buffer/array.

1 Like

Thanks for replying Mr. Ravi. before i trried like that but error is coming, do you have any code related to this. or any example …pleasse send me
Thank You

Hi, @Anish_Pandey

let me shed some light at what Ravi Sir told you. In a nutshell he is asking you to keep a Buffer (Buff[11]), and like how your code is written, just update the Place in the Buffer Whenever you press the Key.
For example,
if(Key == 1){ Buf[0] = 1;}
something like this, and keep yet another function to just update the values in the lcd. now all you have to do is just change the buffer on each key press. and keep a constant function running which will check if there is any change in the buffer and then update it in the lcd.

1 Like

thanks for the reply sir.
ok sir i will go with your concept…
:grinning: Thanks

Now Apart from this, ive attached a PDF, you can go to page No.192, thats chapter6 , project6.2. I hope that helps you more in this.

Hope That Helps You and sorry For the incomplete Reply, My Internet Connection Isn’t great as im travelling.

Parth Temkar

1 Like