MX product - program keypad in VB

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

Moderators: Henry, Mods

Post Reply
tphuynh
LCD?
Posts: 3
Joined: Fri Sep 16, 2005 2:56 pm

MX product - program keypad in VB

Post by tphuynh »

Hi,

I'm trying to program in VB one of the keypad "Enter" to display something like "Power On". For exampling, pressing the Enter button on the LCD pad - will display "Power ON" on the screen.

I know that pressing "enter" on the keypad will store a HEX value of 48 in
MSComm1.input. Somehow I can not get it to display on the screen.

Can someone give me a sample code on how to display some text after pressing one of the keypad.

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

Post by Tom »

Hi tphuynh,

Thank you for posting at the forums.

Please refer to the link at http://www.lcdforums.com/forums/viewtopic.php?t=1961 to display text. What you may want to try after receiving the character is to use some type of if statement. Ex) If 0x48 is detected, then print a specific screen. What you need to make sure you are doing, when you are trying to receive a character is to put some delay in to give sufficient amount of time for the processor to process the information.

If you have anymore questions or concerns, please feel free to post them.

Best Regards,
tphuynh
LCD?
Posts: 3
Joined: Fri Sep 16, 2005 2:56 pm

Post by tphuynh »

Tom wrote:Hi tphuynh,

Thank you for posting at the forums.

Please refer to the link at http://www.lcdforums.com/forums/viewtopic.php?t=1961 to display text. What you may want to try after receiving the character is to use some type of if statement. Ex) If 0x48 is detected, then print a specific screen. What you need to make sure you are doing, when you are trying to receive a character is to put some delay in to give sufficient amount of time for the processor to process the information.

If you have anymore questions or concerns, please feel free to post them.

Best Regards,
Hi Tom,

The link you sent me. I know all of that already. Somehow I can not get the Enter keypad to trigger any display on the screen.

THis is what I have:

If MSComm1.Input = Chr$(&H48) Then
Form1.MSComm1.Output = "Power On"
End If

It's not displaying to the screen. I think I'm missing something, but I can't figure it out. I want this code to fire once the "Enter" keypad is pressed on the MX product. Do I need to put this in a loop?

Another suggestions?
Ray
Matrix Orbital
Matrix Orbital
Posts: 745
Joined: Thu Dec 13, 2001 4:00 pm
Location: Earth.... I think..
Contact:

Post by Ray »

Code: Select all

 
Private Sub Form_Load()
    MSComm1.Settings = "19200,N,8,1"
    MSComm1.CommPort = 3
    MSComm1.InputLen = 0
    MSComm1.RThreshold = 1
    MSComm1.PortOpen = True
End Sub

Private Sub SendText(text As String)
    MSComm1.Output = Chr$(&HFE) & Chr$(&H58)
    MSComm1.Output = text
End Sub

Private Sub MSComm1_OnComm()
    Dim strInput As String
    If MSComm1.CommEvent = comEvReceive Then
        While (MSComm1.InBufferCount > 0)
          strInput = Left(MSComm1.Input, 1) '<---- Evil code here discards all other data in buffer except the first byte
          Select Case strInput
            Case "D"
                SendText "Up"
            Case "E"
                SendText "Down"
            Case "K"
                SendText "Left"
            Case "C"
                SendText "Enter"
            Case "J"
                SendText "F1"
            Case "I"
                SendText "F2"
            Case Else
                SendText "Unknown (" & strInput & ")"
          End Select
        Wend
    End If
End Sub
This code should get you started.
tphuynh
LCD?
Posts: 3
Joined: Fri Sep 16, 2005 2:56 pm

Post by tphuynh »

Thank-you Ray! It worked.

Just had to modify some of the Case values to work with the MX product.

Thanks again! :D
Jeroen Vonk
LCD Guru
Posts: 55
Joined: Tue Apr 12, 2005 2:31 am

Post by Jeroen Vonk »

Hi tphuynh,

You could also try the SDK I wrote (freeware) Should save you a lot of time :) You can find it at http://www.jvonk.info/mosdk Also works in VB...

Regards,
Jeroen
Post Reply