GLK 240128-25 Keypad Assign Codes

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

Moderators: Henry, Mods

Post Reply
Rook
LCD?
Posts: 5
Joined: Mon May 17, 2010 12:22 pm

GLK 240128-25 Keypad Assign Codes

Post by Rook »

Hi,

I'm working with the GLK 240128-25 and a 4x4 keypad using Microsoft Visual Studio.

I am attempting to use the assign keypad codes decimal format but can't seem to figure out my problem. A sample of my code is below.

I am comfortable communicating with the screen via the serial port. Also when I send the following command below, the screen will lock up and have to be power cycled before I can test the effectiveness of the command. I'm sure I am misunderstanding the manual and would greatly appreciate any help.

Code: Select all

    Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button11.Click
   
        Dim barray() As Byte = {254, 213, 1, 1}
        testport.Open()
        testport.Write(barray, 0, barray.Length)
        testport.Close()

    End Sub
Thanks,
Rook

Clark
Matrix Orbital
Matrix Orbital
Posts: 881
Joined: Fri Aug 17, 2007 10:58 am
Location: Matrix Orbital
Contact:

Post by Clark »

Hi Rook,

It may be unclear in the manual and I'll look at that shortly, but when remapping even a part of the keypad you will have to send codes for every key. Given the code provided and the locking up observation, I would say that this unit is waiting for more key codes, and when power is cycled the command is aborted.

With key up and key down values in mind on a 5x5 keypad header, a total of 50 values will be expected for the assign keypad code command.

Give that a go, and if you have any further trouble, let us know.

Thanks,
~Troy
Troy Clark
Design & Development
Matrix Orbital

Rook
LCD?
Posts: 5
Joined: Mon May 17, 2010 12:22 pm

Post by Rook »

Thanks for the quick reply Troy,

So I attempted what you said and I am still unable to get the desired effect. If you could be so kind and to submit a sample of what the command should look like when completed I would really appreciate it.

I attempted sending the code below and the keypad didn't show any character as before it would show the error character (?).

Code: Select all

    Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button11.Click

        Dim aarray() As Byte = {254, 213, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25}

        testport.Open()
        testport.Write(aarray, 0, aarray.Length)
        testport.Close()

    End Sub


Here is the code we are using to read key presses and write to LCD. Before trying to reassign key presses this read code worked fine.

Code: Select all

    Private Sub Button9_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click

            Dim mychar As Char
            testport.Open()
            mychar = Chr(testport.ReadByte())
            TextBox1.Text = testport.ReadByte()
            testport.Write(mychar)
            testport.Close()
        
    End Sub



Thanks,

Rook

Clark
Matrix Orbital
Matrix Orbital
Posts: 881
Joined: Fri Aug 17, 2007 10:58 am
Location: Matrix Orbital
Contact:

Post by Clark »

No worries Rook,

What I think may be happening is that your keypad remap has been successful and now the character you are reading back is not printable. Remember you are sending out raw bytes, so when you specify a 1, you'll get a value of 1 back, not a decimal 49 which represents the ascii character 1.

For debugging, I'd recommend changing the map values to something more displayable for your text box, maybe try 65 to 89 for starters (decimal values of the ascii letters A through Y).

If your read worked before it should still be working, it may just be reading characters it cannot display. In my app note I went with polling mode instead to be sure the keypresses remained saved within the display until I was ready to read them. If you like, you may want to check out the key demo and other programs in the Simple C# AppNote pack.
Troy Clark
Design & Development
Matrix Orbital

Rook
LCD?
Posts: 5
Joined: Mon May 17, 2010 12:22 pm

Post by Rook »

GOT IT!!!! :P :P :P :P

So yeah that was some fun programming. Definitely appreciate all the help on here and over the phone Troy.

I would definitely recommend updating your manual with a description or something else in that section but my partner and I are somewhat novices so take it for what it is worth.

Thanks a ton,

Rook

Clark
Matrix Orbital
Matrix Orbital
Posts: 881
Joined: Fri Aug 17, 2007 10:58 am
Location: Matrix Orbital
Contact:

Post by Clark »

No worries Rook, great to hear you're up and running now, and I'll take your considerations as I re-write new manuals.

All the best in your development,
~Troy
Troy Clark
Design & Development
Matrix Orbital

Post Reply