VK204-25 & Auto Repeat Mode

LK/ELK/VK/PK/OK/MX/GLK/EGLK/GVK/GLT Series

Moderators: Henry, Mods

Post Reply
kfaria
LCD!
Posts: 15
Joined: Thu Jan 19, 2006 10:08 am
Location: Angleton, Texas

VK204-25 & Auto Repeat Mode

Post by kfaria »

Using a keypad via RS232 to an Atmel microcontroller board. Everything works fine except for a problem with the auto key repeat mode. It turns on with 254 126 0 for typematic mode. When I send 254 96, it does not turn the repeating off. What am I missing?

Raquel
Matrix Orbital
Matrix Orbital
Posts: 796
Joined: Thu Aug 19, 2004 3:37 pm
Location: MO Office

Post by Raquel »

Thanks for posting. I do not see any reason for the module not to follow command 254 96 and turn off auto repeat mode. Do you mind sending a piece of your code?
Raquel Malinis
Design and Development
Matrix Orbital

kfaria
LCD!
Posts: 15
Joined: Thu Jan 19, 2006 10:08 am
Location: Angleton, Texas

Post by kfaria »

[quote="Raquel"]Thanks for posting. I do not see any reason for the module not to follow command 254 96 and turn off auto repeat mode. Do you mind sending a piece of your code?[/quote]

'Jog x axis
Gosub Akr_on
Do
Gosub Clr_kb
Gosub Get_kp
If A = 1 Then Jog = Out
If A = 2 Then Jog = In
If A = 3 Then Exit Do
Loop
Gosub Akr_off
End

'Get keypress sub
Sub Get_kp()
A = 0
Gosub Clr_kb
A = Waitkey()
End Sub

'Clear key buffer sub
Sub Clr_kb()
Print Chr(254) ; Chr(69)
End Sub

'Auto key repeat on sub
Sub Akr_on()
Print Chr(254) ; Chr(126) ; Chr(0)
End Sub

'Auto key repeat off sub
Sub Akr_off()
Print Chr(254) ; Chr(96)
End Sub
-=-=-=-=-=-=-=-=-=-

Raquel
Matrix Orbital
Matrix Orbital
Posts: 796
Joined: Thu Aug 19, 2004 3:37 pm
Location: MO Office

Post by Raquel »

Hi kfaria,
I do not see anything wrong with the code. Have you seen A == 3? Since this is the only branch that will actually send the command 254 96, make sure that you actually get the value 3.
By the way, there is really no need to clear the keypad buffer every single time you read a keypad key. The keypad buffer is intended to keep all the keys that are not sent in case you chose to poll the keys pressed instead of being autotransmitted like what you have. Each key when transmitted IS put in the buffer, but then the keys sent when in autotransmit are keys that are NOT from the buffer but from actual key presses.
Raquel Malinis
Design and Development
Matrix Orbital

kfaria
LCD!
Posts: 15
Joined: Thu Jan 19, 2006 10:08 am
Location: Angleton, Texas

Post by kfaria »

Good point.
I put a pause within Akr_off to display a message and wait for a key to see if the sub is being called. Sure is.

Raquel
Matrix Orbital
Matrix Orbital
Posts: 796
Joined: Thu Aug 19, 2004 3:37 pm
Location: MO Office

Post by Raquel »

Hi kfaria
Okay, now we know that the command is being sent. But the problem is even if it is sent, you still see repeated data coming on the RS232 lines on about 2ms apart? I just want to know how you can actually tell that the module did not follow command 254 96 (since in the original code, after sending 254 96, there is no more WaitKey()). The normal operation would be: if the module receives 254 96, it will stop sending repeated data about 2ms apart (providing that the key is being held pressed). But if a new key is pressed, this will be transmitted via RS232.
Raquel Malinis
Design and Development
Matrix Orbital

kfaria
LCD!
Posts: 15
Joined: Thu Jan 19, 2006 10:08 am
Location: Angleton, Texas

Post by kfaria »

That is correct: a key is still repeated after issuing 254 96. Cycling the power stops the repeat. The pause within the Akr_off sub was not in the original code; I tried that after posting the code as another test.

Raquel
Matrix Orbital
Matrix Orbital
Posts: 796
Joined: Thu Aug 19, 2004 3:37 pm
Location: MO Office

Post by Raquel »

Hi kfaria,

Instead of sending 254 96 in Sub Akr_off(), please try sendiing 254 126 1.

Please let me know how it turns out
Raquel Malinis
Design and Development
Matrix Orbital

kfaria
LCD!
Posts: 15
Joined: Thu Jan 19, 2006 10:08 am
Location: Angleton, Texas

Post by kfaria »

Auto repeat stops, but sends key down/key up codes, as stated in the manual.
As another test, I ran uProject and it does not stop the auto repeat either.

Raquel
Matrix Orbital
Matrix Orbital
Posts: 796
Joined: Thu Aug 19, 2004 3:37 pm
Location: MO Office

Post by Raquel »

Hi kfaria,
Can you please tell me the version number of your VK204-25?
Thank you.
Raquel Malinis
Design and Development
Matrix Orbital

kfaria
LCD!
Posts: 15
Joined: Thu Jan 19, 2006 10:08 am
Location: Angleton, Texas

Post by kfaria »

V1.10
0173-05M08

Tom
Matrix Orbital
Matrix Orbital
Posts: 1030
Joined: Mon Jul 19, 2004 4:43 pm
Location: Calgary
Contact:

Post by Tom »

Hi Kurt,

Please email me at tlam@matrixorbital to discuss this.

Best Regards,

kfaria
LCD!
Posts: 15
Joined: Thu Jan 19, 2006 10:08 am
Location: Angleton, Texas

Post by kfaria »

Tom:

Perhaps other users would like this info as well?
I _do_ appreciate the very quick response.

Thanks.....kfaria

Post Reply