Introduction
The Lilliput PC745 is a 7" touchscreen with integrated ARM processor and Windows CE 5.0. It was designed primarily for in car usage. The problem is that controls such as the FM emission AV1 and AV2 input selection, volume control, and screen brightness control are not documented anywhere else.
The following document will provide information on how to control these physical devices on your PC745.
Using the Code
Step 1
Download project zip file, extract it and Import the "LilliputPC745.vb" into your project. Each of the properties and functions has been summarized, with brief descriptions of what they are and how to use them.
The module has been configured to setup the COM2 (IRDA) serial port, so you don't have to worry about it. Just be sure to use "LilliputPC745.Open()
" to start serial communication.
Step 2
When your program starts, you probably want to do the following when your form loads.
Private Sub Form1_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
AddHandler LilliputPC745.AV_Mode, AddressOf AV_Mode
LilliputPC745.Open()
End Sub
Step 3
The Event Handler AV_Mode
lets the following event occur in your form:
Private Sub AV_Mode(ByVal AV As Boolean)
If AV = True Then
Else
End If
End Sub
This will run when the unit either enters AV1 or AV2 or when it returns to display. It will return "True
" when in AV mode and "False
" when in display mode.
Step 4
The rest of the functions are quite simple to:
- switch to AV1, simply use "
LilliputPC745.AV1()
"
- switch to AV2, make use of "
LilliputPC745.AV2()
"
- adjust the brightness, use "
LilliputPC745.Brightness =
"
- adjust the volume, use "
LilliputPC745.Volume =
"
- adjust the FM emission frequency, use "
LilliputPC745.FM_Mhz =
"
- enable the FM emission, use "
LilliputPC745.FM_Open()
"
- disable the FM emission, use "
LilliputPC745.FM_Close()
"
Step 5
In order to exit the AV mode, and to adjust the AV setting, you need to input the touch screen coordinates so that the AV menu can appear and be controlled. First read the coordinates using "MousePosition.X
" and "MousePosition.Y
". Create a new Point
, assign the mouse location to the point and make "LilliputPC745.Touch
" equal to that point.
Private Sub Form1_MouseDown(ByVal sender As Object, _
ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDown
Dim Coordinate As Point
Coordinate.X = MousePosition.X
Coordinate.Y = MousePosition.Y
LilliputPC745.Touch = Coordinate
End Sub
Step 6
This step is quite important. Before closing your program, you must end the serial communication on COM2. The following code shows how you can do this, using the LilliputPC745.vb Module. If you close the program before closing the serial port, you will have problems restarting the serial port.
Private Sub Form1_Closing(ByVal sender As Object, _
ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
LilliputPC745.Close() End Sub
Source Code
Here is the source code for the LilliputPC745.vb Module:
Imports System
Imports System.IO.Ports
Module LilliputPC745
Dim FM_On As Boolean = False Public Event AV_Mode(ByVal AV As Boolean)
WithEvents COM2 As New SerialPort("COM2", 9600, Parity.None, 8, StopBits.One)
Public Sub Open()
If COM2.IsOpen = True Then COM2.Write(Gen_ChkDig("T46")) Else
COM2.Open() End If
End Sub
Public Sub Close()
If COM2.IsOpen = True Then
COM2.Close()
End If
End Sub
Private Sub COM2_DataReceived(ByVal sender As Object, _
ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) _
Handles COM2.DataReceived
Dim str1 As String = COM2.ReadExisting()
If str1 = "V426" Then RaiseEvent AV_Mode(True)
End If
If str1 = "V415" Then RaiseEvent AV_Mode(False)
End If
End Sub
Public WriteOnly Property Brightness() As Integer
Set(ByVal value As Integer)
If (value < 100) And (value > 0) Then If COM2.IsOpen = True Then COM2.Write(Gen_ChkDig(value.ToString("T71000")))
End If
End If
End Set
End Property
Public WriteOnly Property Volume() As Integer
Set(ByVal value As Integer)
If (value < 100) And (value > 0) Then If COM2.IsOpen = True Then COM2.Write(Gen_ChkDig(value.ToString("T72000")))
End If
End If
End Set
End Property
Public Sub FM_Open()
FM_On = True
End Sub
Public Sub FM_Close()
FM_On = False
End Sub
Public WriteOnly Property FM_Mhz() As Double
Set(ByVal value As Double)
If (value <= 108.9) And (value >= 77.0) Then If COM2.IsOpen = True Then If FM_On = True Then COM2.Write(Gen_ChkDig(value.ToString("T95000.01")))
Else
COM2.Write(Gen_ChkDig(value.ToString("T95000.00")))
End If
End If
End If
End Set
End Property
Public Sub AV1()
If COM2.IsOpen = True Then COM2.Write(Gen_ChkDig(Gen_ChkDig("T531")))
End If
End Sub
Public Sub AV2()
If COM2.IsOpen = True Then COM2.Write(Gen_ChkDig(Gen_ChkDig("T532")))
End If
End Sub
Public WriteOnly Property Touch() As Point
Set(ByVal Touch As Point)
Dim str_X As String Dim str_Y As String If (Touch.X >= 0) And (Touch.X <= 800) And (Touch.Y >= 0) _
And (Touch.Y <= 480) Then
str_X = Touch.X.ToString("000") str_Y = Touch.Y.ToString("000")
If COM2.IsOpen = True Then COM2.Write(Gen_ChkDig("T04" & str_X & str_Y))
End If
End If
End Set
End Property
Private Function Gen_ChkDig(ByVal In_Data As String)
Dim Out_Data As String Dim int_Sum As Integer Dim x As Integer Dim chrTemp As Char
For x = 2 To Len(In_Data)
chrTemp = Mid(In_Data, x)
int_Sum = int_Sum + Val(chrTemp)
Next x
Out_Data = In_Data & CStr(int_Sum Mod 10)
Return Out_Data
End Function
End Module
Serial Commands
Commands are sent to the Hardware through the IRDA port, which has to be configured as follows:
Com2 (IRDA) |
|
Bits per Second |
9600 |
Data bits |
8 |
Parity |
None |
Stop Bits |
1 |
Flow Control |
None |
Data is sent through COM2 (IRDA) port, at the end of each command there is a check digit. The check digit is calculated by summing all of the individual digits and then taking the modulus of the sum. See the attached zipped Excel sheet.
Video Inputs |
|
Video 1 |
T531 |
Video 2 |
T532 |
Touch Screen |
|
Command |
T04###### |
X Min |
T04000### |
X Max |
T04800### |
Y Min |
T04###000 |
Y Max |
T04###480 |
FM Emission |
|
Command Open |
T95###.#1 |
Command Closed |
T95###.#0 |
F Min (77.0Mhz) |
T95077.0# |
F Max(108.9Mhz) |
T95108.9# |
Brightness |
|
Command |
T71### |
Increments |
5 |
Min |
T71000 |
Max |
T71100 |
Volume |
|
Command |
T72### |
Increments |
5 |
Min |
T72000 |
Max |
T72100 |
The Touch screen values have to be returned to the hardware when in AV mode so that the AV mode menu can appear, which will enable you to exit back to Windows.
Points of Interest
I asked Lilliput's support team if they can provide me with some information several times and got no response, so I took the matter in my own hands by reverse engineering it!
I actually had a lot of fun, trying to get the touch screen to work in the AV mode, if you don't return the proper command sequence it just hangs.
It also took me a long time to figure out what kind of check digit is used at the end of each command. I was pulling my hair out doing all kinds of crazy math, when I realized that I need to put a load of data into an Excel file, and massage the data. After about 2 days of pondering, I figured out how that was done.
I spent about 2 weeks to figure out how all of it works, and now I want to share it with the world so that when the next person comes around, lucky them ;).
I'm a firm believer in open source, and I just hope that someone finds this information useful. If you use this, please let me know what you are doing with your PC745.
History
- 22nd April, 2010: Initial post