I have a problem clearing the keypad buffer
I have a problem clearing the keypad buffer
I am trying to use the LK204-7t-1U-USB LCD and it looks that I am not able to clear the keypad buffer with oxfe 0x45 command I wonder if this is known issue and if it is do you have a solution for that.
Hello,
Thank you for posting on the forum.
Your command is correct; I will check this out with a current LK204-7T-1U-USB (firmware v5.0) display and let you know.
Update:
I tested the command on a current display and it works fine.
Can you please tell me what you observe the display is doing; and perhaps what you intend to do with the command?
Thank you for posting on the forum.
Your command is correct; I will check this out with a current LK204-7T-1U-USB (firmware v5.0) display and let you know.
Update:
I tested the command on a current display and it works fine.
Can you please tell me what you observe the display is doing; and perhaps what you intend to do with the command?
Raquel Malinis
Design and Development
Matrix Orbital
Design and Development
Matrix Orbital
I am using this LCD in an embedded design using micro and my goal is to read entered key once and run some commands and clear the buffer for the next run of the loop but it seems even after clearing the buffer I still read some key from keypad so it goes into repetitive loop. I wonder if there is any setting for the keypad that I am missing in my code
my code looks like this
printf("%c",0xFE);//There is a LCD check to see if key is pressed
WaitMilliseconds(10);
printf("%c",0x26);
WaitMilliseconds(10);
scanf("%c",&KeyPressed);
if ((KeyPressed==0x48)) //down arrow decrease it
{
if ((Contrast+ConSteps)<=0xff)
{
Contrast=Contrast+ConSteps;
printf("%c",0xFE);
WaitMilliseconds(10);
printf("%c",0x91);
WaitMilliseconds(10);
printf("%c",Contrast);
}
printf("%c",0xFE); //Clear the keypad buffer
WaitMilliseconds(10);
printf("%c",0x45);
WaitMilliseconds(10);
}
my code looks like this
printf("%c",0xFE);//There is a LCD check to see if key is pressed
WaitMilliseconds(10);
printf("%c",0x26);
WaitMilliseconds(10);
scanf("%c",&KeyPressed);
if ((KeyPressed==0x48)) //down arrow decrease it
{
if ((Contrast+ConSteps)<=0xff)
{
Contrast=Contrast+ConSteps;
printf("%c",0xFE);
WaitMilliseconds(10);
printf("%c",0x91);
WaitMilliseconds(10);
printf("%c",Contrast);
}
printf("%c",0xFE); //Clear the keypad buffer
WaitMilliseconds(10);
printf("%c",0x45);
WaitMilliseconds(10);
}
If you do this, KeyPressed will remain to be whatever it was last read.my goal is to read entered key once and run some commands and clear the buffer for the next run of the loop
So you need to be sending the 0xFE 0x26 Poll keypress command again and KeyPressed should then be 0x00 value. Ie. make sure that
is included in the loop.printf("%c",0xFE);//There is a LCD check to see if key is pressed
WaitMilliseconds(10);
printf("%c",0x26);
WaitMilliseconds(10);
Raquel Malinis
Design and Development
Matrix Orbital
Design and Development
Matrix Orbital
Can you please try sending the Set Auto Repeat Off command (0xFE 0x60) at the beginning of the code? This will make sure that any key up or prolonged presses will not be reported.
Also, the delay idea is good although I am not aware of the need. But it sure won't hurt (for now) to add in a delay just after sending the 0xFE 0x45 command. Try 10ms (this is long but we want to see the effect of the delay).
Let me know how it turns out.
Also, the delay idea is good although I am not aware of the need. But it sure won't hurt (for now) to add in a delay just after sending the 0xFE 0x45 command. Try 10ms (this is long but we want to see the effect of the delay).
Let me know how it turns out.
Raquel Malinis
Design and Development
Matrix Orbital
Design and Development
Matrix Orbital