Option Explicit Private InputQueue(1 To 10) As Byte Private OutputQueue(1 To 30) As Byte Dim Key1 As Byte Dim Key2 As Byte Dim TimedOut As Boolean Public Sub Main() Call OpenQueue(InputQueue, 10) Call OpenQueue(OutputQueue, 30) Call DefineCom3(13, 14, bx0000_1000) Call OpenCom(3, 9600, InputQueue, OutputQueue) Delay 0.8 Call PutQueueStr( OutputQueue, Chr(12) & " LCD03/Keypad Test" ) Delay 0.5 Do Call ClearQueue(InputQueue) Call PutQueueStr( OutputQueue, Chr(16) ) Call GetQueue(InputQueue, Key1, 1, 0.5, TimedOut) Call GetQueue(InputQueue, Key2, 1, 0.5, TimedOut) Call PutQueueStr( OutputQueue, Chr(2) & Chr(41)) If (Key1 = 1) then Call PutQueueStr( OutputQueue, "Key 1" ) ElseIf (Key1 = 2) then Call PutQueueStr( OutputQueue, "Key 2" ) ElseIf (Key1 = 4) then Call PutQueueStr( OutputQueue, "Key 3" ) ElseIf (Key1 = 8) then Call PutQueueStr( OutputQueue, "Key 4" ) ElseIf (Key1 = 16) then Call PutQueueStr( OutputQueue, "Key 5" ) ElseIf (Key1 = 32) then Call PutQueueStr( OutputQueue, "Key 6" ) ElseIf (Key1 = 64) then Call PutQueueStr( OutputQueue, "Key 7" ) ElseIf (Key1 = 128) then Call PutQueueStr( OutputQueue, "Key 8" ) ElseIf (Key2 = 1) then Call PutQueueStr( OutputQueue, "Key 9" ) ElseIf (Key2 = 2) then Call PutQueueStr( OutputQueue, "Key *" & Chr(19) ) ElseIf (Key2 = 4) then Call PutQueueStr( OutputQueue, "Key 0" ) ElseIf (Key2 = 8) then Call PutQueueStr( OutputQueue, "Key #" & Chr(20) ) Else Call PutQueueStr( OutputQueue, "Key " ) End If Loop End Sub