In recent years, the widespread adoption of LCD displays and the development of high-capacity microprocessors have significantly improved the human-computer interaction capabilities of embedded systems. In many cases, a good graphical user interface (GUI) and a user-friendly operating environment are key factors influencing product success. How to fully utilize the low-cost, resource-constrained microcontroller system to achieve comprehensive human-computer interaction has become a problem that microcontroller designers need to solve.
Currently, many advanced intelligent instruments, both domestically and internationally, not only boast high performance indicators in terms of measurement accuracy and sampling rate, but also offer unique advantages in human-computer interaction. During the development of an intelligent pressure monitoring instrument for TOX Stamping Technology GmbH in Germany, the author accumulated some design experience in embedded system human-computer interaction technology. This article uses this as an example to introduce its design methodology.
1. Overview of Intelligent Pressure Monitoring Instrument
The intelligent pressure monitoring instrument is a specialized instrument developed for TOX Stamping Technology GmbH in Germany. This company specializes in producing stamping equipment for joining metal sheets. To ensure the quality of the joins, it is necessary to monitor the pressure during the stamping process and compare the measured values with the set upper and lower pressure limits to determine whether the connection is qualified. Figure 1 shows the structural block diagram of the TOX intelligent pressure monitoring instrument hardware system. It is based on a microcontroller and includes pressure and displacement sensors, signal conditioning circuitry, an LCD display circuit, buttons, RS232 and RS485 communication interfaces, and input/output interfaces for connecting to a PLC.
In addition to the measurement, data processing, and communication functions found in ordinary intelligent instruments, the TOX intelligent pressure controller provides users with a user-friendly human-machine interface menu. Through buttons and the LCD display, users can flexibly set and query the following information: measurement program number and corresponding upper and lower pressure limits; sensor type, specifications, and sensitivity; sensor zero-point offset and maximum allowable offset range; whether automatic zero-point calibration is enabled; whether the communication interface is enabled; the communication interface mode and address; the latest 10 sets of measurement data; user password; language (Chinese or English); equipment maintenance cycle and number of operations, etc. Furthermore, a memory protection function is included.
2. Control Panel and User Interface
Figure 2 shows the control panel of the TOX intelligent pressure monitor. The panel features a 160×80 dot-matrix LCD display and six buttons. The LCD display shows 20 English or 10 Chinese symbols per line, for a total of five lines. The six buttons are 0, ENTER, and ESC. Using these six buttons, users can easily switch between the "Measurement" and "Menu" interfaces. In the menu interface, users can conveniently set and query relevant information.
After powering on, the device will display the version number, then perform "sensor calibration" (this function can be turned off), and then enter the "measurement" interface shown in Figure 3.
In the measurement interface, if a measurement command is received from the PLC, or if the user presses the "F1" or "F2" key, the pressure of channel 1 or channel 2 will be measured, and the measurement results will be processed and displayed. If the user presses the "ESC" key, the "main menu" interface shown in net 4 will be entered.
After entering the main menu interface, press the " key to move the cursor; press the "ESC" key to return to the previous menu (i.e., the "Measurement" menu); press the "ENTER" key to enter the selected submenu. For example, when the cursor is on the "Measurement Program" option, if you press the "ENTER" key, you will enter the "Measurement Program" input submenu shown in Figure 5.
The "Measurement Program" submenu has five options: the program number and the upper and lower pressure limits (i.e., minimum and maximum values) for channels 1 and 2, respectively. The user-selected setting is also displayed. Similarly, the buttons can be used to move the cursor; pressing the "ESC" key returns to the previous menu (i.e., the main menu); pressing the "ENTER" key enters the submenu below the cursor's current location. For example, when the cursor is on the "Minimum Value" option for channel 1, pressing the "ENTER" key will enter the "Minimum Value" setting interface shown in Figure 6.
In Figure 6, "30.00" indicates that the minimum pressure of channel 1 is 30.00, and "_" is the cursor prompt. To modify the setting, the user can press the ▲ key to move the cursor to the corresponding position, and then press the key to modify the setting. For example, when the cursor is at the current position, pressing the "▲" key changes the setting from 30.00 to 31.00; pressing the key changes the setting from 30.00 to 29.00. In this way, the setting can be easily entered using only four keys.
The main menu's "Sensor Configuration," "Data," and "Other" options also contain nested sub-menus of varying numbers of first-level, second-level, and even multi-level sub-menus, allowing users to query, modify data, and configure parameters.
As can be seen, despite having 6 operating buttons and 1 LCD display, the TOX intelligent pressure monitor still provides a user-friendly operating environment and realizes human-machine interaction.
3. Design of Human-Computer Interaction Menu
In this design, the main menu and submenus comprise over 20 pages, and offer both Chinese and English language options for users, thus increasing the complexity of the application layer program design. The program adopts a modular structure, mainly including the following modules:
Interface Switching Control Module : To switch the operating interface according to user requirements, a Page_Point image register is defined, whose value varies between 0 and 1, where P is the number of operating interfaces. If Page_Point = 0, the LCD displays page 0 (the measurement interface shown in Figure 3); if Page_Point = 1, the LCD displays page 1 (the main menu interface shown in Figure 4). When the user presses the "ENTER" or "ESC" key, the value of Page_Point is modified according to the position of the option cursor, and then the displayed window is updated, realizing human-computer interaction.
Key scanning module : Scans the six operation keys and stores the results in the Key_Status image register. This register has six valid bits: Key_Up, Key_Down, Key_Left, Key_Right, Key_Esc, and Key_Enter, corresponding to the six keys "ESC" and "ENTER" on the operation panel, respectively. If the flag bit is 1, it means that the corresponding key is pressed; otherwise, it is released.
Option Management Control Module : If the current operation interface belongs to the "Option Interface" (both the main menu interface shown in Figure 4 and the measurement program sub-interface shown in Figure 5 belong to the Option Interface), pressing the key will move the cursor ">" position up or down by 1 item. For this purpose, an Option_Point image register is defined, with a value from 0 to N-1 (N being the number of options). If the main menu has 4 options, then N=4, and Option_Point is 0 to 3; if the measurement program sub-menu has 5 options, then N=5, and Option_Point is 0 to 4. Figure 7 shows the program flowchart of the Option Management Control Module.
Data Input Module : If the current operation interface belongs to the "Set Value Interface" (the minimum value setting interface shown in Figure 6 belongs to the Set Value Interface), pressing the and keys will move the cursor "_" position one position to the left or right. For this purpose, a Bit_Point image register is defined to record the position of the modifiable data bit. Pressing the key will add "1" or subtract "1" from the value of the data bit currently occupied by the cursor. For example, in the minimum value setting interface shown in Figure 6, pressing the "▲" key changes the setting value from 30.00 to 31.00; pressing the "v" key changes the setting value from 30.00 to 29.00. With just four keys, any value that meets the user's requirements can be easily input. Figure 8 is the program flowchart of the data input module.
Using the modules described above, functions such as selecting options, modifying data, and switching user interfaces can be flexibly implemented with only a small amount of program code.
This design uses assembly language programming and employs a low-performance PIC16F877A microcontroller. Although its program memory is only 8KB, it has achieved the display and switching of more than 20 pages of operation interface, as well as human-computer interaction functions such as setting and querying dozens of data points. It has also implemented measurement, monitoring and communication functions.
4. Conclusion
Human-computer interaction technology for embedded systems is becoming increasingly sophisticated. Through an LCD display and a few buttons, software can be used in embedded system design to implement human-computer interaction functions such as parameter setting and data management, enhancing the enjoyment and functionality of operation and helping to increase the added value of the system.