“The functions of a vehicle-mounted accusation platform are mainly embodied in the following aspects: monitoring and displaying the technical status of the vehicle; inter-vehicle accusation and communication; vehicle positioning and navigation; various document processing. This article will introduce the design of the human-machine interface part of a vehicle-mounted command and control system based on ARM and MiniGUI. This system initially realizes the main functions of the above-mentioned vehicle-mounted command and control platform.
Introduction: The functions of an on-board command and control platform are mainly embodied in the following aspects: monitoring and displaying the technical status of the vehicle; inter-car command and communication; vehicle positioning and navigation; various document processing. This article will introduce the design of the human-machine interface part of a vehicle-mounted command and control system based on ARM and MiniGUI. This system initially realizes the main functions of the above-mentioned vehicle-mounted command and control platform.
l Selection of software and hardware
Limited by the internal space of the vehicle, the command and control terminal must be miniaturized and embedded. ARM is an architecture that has been widely used in many fields, and it is a good choice to adopt it here. For this topic, the S3C2410 chip of SAMSUNG, which has a wider domestic market, was selected as the CPU. The S3C2410 chip is mainly used in handheld devices or other occasions that have higher requirements for power consumption, cost, and performance. In order to reduce the cost of the whole machine, the chip has built-in 16 KB instruction and data cache, MMU, UART, ADC, LCD controller, I2C bus interface, IIS bus interface, USB master-slave device support, touch screen interface, etc. This design Improve the integration of the system, but also provide great convenience to the system development.
There are many options for system software. Because the chip has a built-in MMU, it can support multiple mainstream embedded operating systems such as Windows CE, Linux, Palm OS, and VxWorks. The vehicle-mounted accusation platform does not require high real-time performance, so embedded Linux is chosen as the operating system here. Embedded Linux has the characteristics of open source code, low cost, and abundant application software. Therefore, Linux and ARM are the preferred combination for many low-cost applications.
As the accusing terminal, there must be special requirements for the user’s graphical interface. This project chooses FMCG’s MiniGUI as the graphical engine. MiniGUI is a graphical user interface support system specifically for embedded systems. It defines a set of lightweight windows and graphical device interfaces for applications. Using these interfaces, each application can create multiple windows and create various controls in these windows. In the software system, it lies between the kernel and the application program. Here, MiniGUI will be used to complete the programming of the user graphical interface.
2 hardware design
There are many mature design examples for the application circuit of the ARMS3C2410 chip; in the design stage, there are also many development boards available on the market. This project selects the ARM SYS2410 development board from Hangzhou Liyutai Company as the hardware platform for development.
The development board adopts the structure of separating the core board and the expansion board, provides most of the peripheral interface circuit, and has 200 lead-out pins, which leads to most of the I/0 ports on the CPU. This provides for the subsequent development work It’s convenient.
2.1 Keyboard matrix circuit
The command and control terminal functions of this project can be divided into 6 items. After each item is selected, in order to facilitate the input or selection of sub-items, 10 numeric keys are added. In addition, the OK key, the cancel key, and the 6 function keys are added, making a total of 24 keys. Because of the large number of keys, these keys are designed into a determinant keyboard matrix (see Figure 1).
Combined with the circuit structure of the development board, the column input port of the keyboard matrix uses six general-purpose I/O lines from GPE5 to GPElO, and the row output port uses four general-purpose I/0 lines from GPEll to GPEl4, at the intersection of the row line and the column line. Access the key switch.
The principle of keyboard scanning is to check the keyboard matrix at regular time intervals to determine whether a key is pressed. The keyboard scanning can adopt a dedicated chip or a software method. This project adopts a software method.
2.2 Display drive circuit
The second focus of the command and control terminal input/output device is the display device. The ARM chip has a built-in LCD controller, which can easily realize the display function. But what the ARM LCD controller supports is TTL level RGB component display, and most of the larger industrial LCD screens on the market currently have LVDS level interfaces, so interface circuits are required.
Another solution is to convert the RGB signal of the TTL level of the ARM development board into a VGA signal, so that the choice of the display is more arbitrary and the cost is reduced. RGB signal can be converted into VGA signal by using a dedicated AD chip, such as ADV7120, ADV7123, etc.
3 software design
Software design needs to complete two aspects of work: one is driver programming; the other is GUI programming.
3.1 Writing the keyboard matrix driver
Development boards generally provide corresponding drivers for the hardware they provide, and self-developed peripheral circuits generally need to write their own drivers. The device driver is an important part of the Linux kernel. Only through the driver can the operating system control the hardware behavior of the peripheral.
Inside the system, access to I/0 devices is carried out through a series of entry points. Character devices provide the following entry points: open, close, read, write, ioctl; they correspond to open, close, and read respectively. Equipment, writing equipment, and other operations. The definition of these entry points is done through an important data structure file_operations.
The key points of keyboard driver programming are:
(1) Define a 6×4 key value matrix, as the output, press a key to get the corresponding key value;
(2) Set the read/write mode of the used I/O port during initialization, the row line is write, and the column line is read;
(3) Define the keyboard scan function scan_kbd(). Its algorithm is: all the row lines are set to low level during initialization, if no key is pressed, the column lines will all read high level. Otherwise, the closure of any key will cause the column to become low.
(4) At the read entry point, which is the read method defined by the file_operations structure, call scan_kbd(). In this way, the driver can scan several I/O ports regularly, obtain the key value, and then send it to the user address space through putuser.
Set the I/O mode, read/write the bit of the I/0 port, through the header file S3C2410. Specially defined macros set_gpio_ctrl, write_gpio_bit, read_gpio_bit in h.
After the keyboard driver is compiled, it can be compiled into the kernel as a device file, or a module can be dynamically loaded.
3.2 The realization of MiniGUl IAL engine
Generally, MiniGUI should be configured and compiled according to the characteristics of the target system before use, such as specifying the target operating system, running mode, graphics engine and input engine, font type, character set, supported control classes, etc. In this subject, because a self-designed keyboard is used as an input device, the most important configuration is the input abstract lay-er (IAL).
The abstraction layer is a set of abstract interfaces that do not depend on the hardware. Its function is similar to the driver of the operating system. It isolates the underlying hardware operation from the operating system. This simplifies the difficulty of porting on different platforms. The development of specific keyboard input is mainly to complete two parts: keyboard driver design and keyboard input engine development. The former is responsible for receiving original input events and data from the keyboard, and the latter is responsible for converting the original input events and data into MiniGUl abstract keyboard events and data.
In terms of code implementation, MiniGUI uses the INPUT data structure to represent the input engine. A number of function pointers are specified in the structure, and the specific input engine is written, which is mainly to encode each function in the INPUT structure. After the new IAL engine is written, MiniGUI should be added for configuration, and then MiniGUI should be compiled. In engineering practice, a relatively simple method is to modify the engine that MiniGUI has implemented.
3.3 Graphical interface design
MiniGUI is a graphical user interface support system. The usual GUI programming concepts are suitable for MiniGUI programming, such as window and event-driven programming. The functions completed by an embedded system are generally relatively single. For this system, the focus is on the realization of the human-machine interface, so it only needs to poll the user’s key input. as shown in picture 2.
There are three types of windows in MiniGUI: main window, dialog box and control window. Every MiniGUI application generally has to create a main window as the main interface or start interface of the application. MiniGUI contains many control classes, such as static boxes, buttons, list boxes, edit boxes, progress bars, etc. These control classes can achieve similar effects to Windows standard controls.
The most important functions are:
Among them, WndProc is the message processing function of this window. Here, the message loop can be started immediately. E.g:
After the keyboard driver is added and the MiniGUI input engine is modified, the application can respond to keyboard messages and handle various events. In addition to standard control support, MiniGUI also provides graphics device interface (GDI) support. Through GDI, the program can output graphics on the computer screen, including basic graphics and text output. Using this method, the meters and various forms required by the command terminal can be drawn.
3.4 Other issues
During the development of this subject, some other problems were encountered, which are summarized as follows:
(1) The color depth of the display. As a command terminal, the display resolution designed by this subject is 640×480. If the color depth is more than 16 bits, it will be a relatively large burden on the ARM processor, and the picture will be jittery and inconsistent. The processing method is to set the color depth to 8 bits, which needs to be solved by modifying the Linux display driver.
(2) The anti-shake problem of the keyboard. The jitter problem of keys is a common problem, which can be dealt with by software delay or other means.
(3) Further enrichment of terminal functions. This topic only realizes the human-machine interface of the terminal, but as a complete terminal, the networking and data transmission between the terminals, the hardware interface between the terminal and the working condition acquisition device, and data exchange should also be considered. These need to further develop and utilize other peripherals on the ARM chip, which is the next goal of the subject.
ARM, as a cost-effective embedded chip, combined with the graphics system MiniGUI, is the best choice for embedded graphics interface programming. Experiments have proved that the software and hardware systems introduced in this article have better realized several functions of the vehicle-mounted command and control platform mentioned in the introduction of this article. As a typical vehicle-mounted embedded system, the design principles and methods of the vehicle-mounted command and control system are also applicable to other embedded systems.
The Links: DMF50081NF-FW EPCS16SI8N