In modern portable smart instruments and handheld devices, Chinese human-machine interfaces have become a de facto industry standard. Graphical dot-matrix LCDs capable of displaying Chinese characters and numeric keypads for inputting numbers have become indispensable components of smart devices. Meanwhile, low power consumption, a fundamental requirement for portable devices, is consistently incorporated into the design of Chinese human-machine interfaces.
This low-power Chinese human-computer interaction interface requires designers to have special considerations in selecting the MCU and specific components. Low power consumption and small size should be the primary requirements for selecting relevant components.
In this design, the MSP430F149 microcontroller was used as the system's MCU. By selecting a suitable LCD module, a low-power Chinese human-machine interface was constructed at a 3V level. This Chinese human-machine interface constitutes an important component of the low-power data acquisition system.
I. Low Power Consumption Characteristics of MSP430 Series FLASH Microcontrollers
Texas Instruments (TI)'s MSP430F14x series is an ultra-low-power, Flash-based, 16-bit RISC instruction set microcontroller. It employs a von Neumann architecture, with RAM, ROM, and all peripheral modules residing in the same address space. It boasts a rich set of on-chip and peripheral features, offering exceptional cost-effectiveness.
The MSP430F14x series is the most powerful sub-series of TI's MSP430F1x series (FLASH memory type) microcontrollers. The F14x features larger program and data storage areas, more peripheral modules, and even includes an on-chip hardware multiplier. Furthermore, the F14x series microcontrollers offer simple development tools, and the programs stored in FLASH memory are easily upgraded and debugged online, making them ideal for developing consumer portable electronic products.
The MSP430F14x microcontroller embodies the advanced low-power design philosophy of modern microcontrollers. Its design architecture is entirely centered on low-power system operation.
This low-power structure is specifically reflected in the following four aspects:
(1) Highly integrated, fully monolithic design. Many peripheral modules are integrated into the MCU chip, increasing hardware redundancy. The internal design follows the principles of low power consumption and low voltage, which makes the system not only powerful, reliable, and cost-effective, but also facilitates further miniaturization and portability.
(2) The internal circuits can operate selectively. The F14x microcontroller can select different function circuits through special function registers, that is, it relies on software to select different peripheral function modules. For modules that are not used, they are stopped to reduce unnecessary power consumption.
(3) It has two clocks, one high-speed and one low-speed. The higher the system operating frequency, the greater the power consumption. To better reduce power consumption, the F14x microcontroller can use three independent clock sources: a high-speed main clock, a low-frequency clock (such as 32.768kHz), and a DCO on-chip clock. The MCU main clock frequency can be reduced by a certain proportion to reduce power consumption while meeting functional requirements. When high-speed operation is not required, the secondary clock can be used for low-speed operation to further reduce power consumption. The CPU clock frequency can be changed by assigning values to special function registers in software, or the main clock and secondary clock can be switched.
(4) Multiple energy-saving operating modes. The F14x microcontroller has five energy-saving modes: LPM0, LPM1, LPM2, LPM3, and LPM4. These five modes provide excellent performance guarantees for its power consumption management. Figure 1 shows the actual operating current consumed in the active state (AM) and various energy-saving modes.
Figure 1. Relationship between F14x operating mode and operating current
The MSP430F14x series is specifically developed for ultra-low power portable applications. Utilizing advanced integrated circuit technology and manufacturing processes, its power consumption has moved beyond the milliamp level and truly entered the microamp level.
Furthermore, the F14x's software architecture is designed for low power consumption. For example, waking the MCU from standby mode takes only 6μS. Its interrupt and subroutine calls have no hierarchical restrictions; this rich interrupt capability reduces the need for system polling and facilitates the design of control programs with interrupt routine structures.
The F14x series microcontrollers can be used to easily build a low-voltage operating platform. By combining intelligent operation management of each functional module with the MCU's energy-saving mode, the contradiction between operating speed, data flow, and low-power design can be resolved, minimizing the current consumption of each functional module and limiting activity to the lowest possible level. This optimization achieves extremely low power consumption for the microcontroller. For example, at a 1MHz operating frequency, the F14x consumes only 0.1–400μA of current (1.8–3.6V power supply). With a 1.8V power supply, it consumes only 160µA during execution and 0.1µA in standby mode, while effectively retaining the data in RAM.
In summary, the MSP430F14x microcontroller features extremely low power consumption, powerful processing capabilities, a rich set of on-chip peripheral modules, and a convenient and efficient development approach.
The MSP430F149 microcontroller used in this system is the most powerful model in the F14x series. It features a hardware multiplier, six I/O ports (each with eight I/O pins), a precise analog comparator, two timers with capture/compare registers, an eight-channel 12-bit A/D converter, an on-chip watchdog timer, two serial communication interfaces, 60KB of Flash ROM, and 2KB of RAM. The F149 also boasts powerful expansion capabilities, with 48 I/O pins. Each I/O port corresponds to multiple registers for input, output, function selection, interrupt, etc., allowing for the multiplexing of function ports and general-purpose I/O ports, greatly enhancing port functionality and flexibility, and improving the development capabilities for peripheral devices.
The above features of the MSP430F149 make it very suitable for building a full-featured portable microcontroller application system.
II. LCD Display Module and Interface Circuit
Graphic dot-matrix LCDs can display user-defined symbols and graphics, and the display can be scrolled. As an important component of the human-machine interface in portable microcontroller systems, they are widely used in instruments for real-time detection and display. Graphic dot-matrix LCDs that support Chinese character display are a very common display device in modern microcontroller applications; the displays on Chinese character pagers and mobile phones are graphic dot-matrix LCDs. Together with a matrix keypad, they form the most common human-machine interface in modern microcontroller applications.
Compared with other display methods, the main advantages of using graphic dot-matrix LCD displays are as follows:
(1) Low operating voltage and extremely low power consumption. The operating voltage is 3-5V and the operating current is ≤10uA/cm2, making it particularly suitable for portable instruments.
(2) Liquid crystal displays are passive displays and are less affected by external light.
(3) Graphic dot matrix LCDs can display a large amount of information and have high resolution.
(4) It does not generate electromagnetic interference.
(5) High reliability. Long service life.
In this design, the author used the MG-12232 LCD module from Truly. The MG-12232 module typically operates at 3V and has a typical current of 0.3mA, making it well-suited for the low-power environment of this system with its 3V level. It can display a 122×32 dot matrix, enabling a "dual-row Chinese character display." The MG-12232 uses two SED1520 controllers, each capable of driving 16 rows × 80 columns. The SED1520 controller operates normally under 3V logic, thus avoiding the problem of logic level mismatch with the MSP430 microcontroller. Its specific block diagram is shown in Figure 2.
The SED1520 controller serves as the interface between the LCD screen and the MCU, directly driving the MG-12232 LCD and controlling the display of characters, Chinese characters, and graphics. Since the MSP430F149 has 48 I/O pins, the SED1520 allows direct simulation of LCD read/write and control timing using the MSP430's I/O ports. This transforms the MCU's operation of the LCD into the MCU's operation of the SED1520 LCD controller, significantly simplifying both the hardware connection and software programming of the interface circuit.
In Figure 2, the "V5" pin provides the contrast voltage for the MG-12232 LCD. It can be generated by a -12V voltage generator circuit (such as MAX765) and then divided by a 100K potentiometer before use.
The MCU can access the LCD module through some control pins and 13 commonly used instructions of the SED1520. For example, "RST" is used to restart the SED1520, "E1" and "E2" are used to enable two SED1520 chips respectively. "R/W" controls whether to read or write to the SED1520. "A0" determines whether the operation is an instruction read/write or a data read/write.
An SED1520 display controller can control an 80×16 dot matrix LCD display. Its display RAM has 16 rows, divided into two pages of 8 rows each. The data registers of each page correspond to the 8 rows of pixels on the LCD screen. Setting the page address and column address determines a unique unit in the display RAM. Each column on the screen corresponds to a byte of content in the display RAM, with the bottom bit of each column being the MSB and the top bit being the LSB. This means that the data bits of the RAM unit's byte data, from least significant bit to most significant bit, correspond to the 8 data bits of a specific column on the display screen, from most significant bit to least significant bit. Assigning a value to a byte in the display RAM controls whether the pixels in the current column (one page) are displayed. As shown in Figure 3, the P5 port of the MSP430F149 microcontroller is used as the data port for communication with the LCD module.
The MG-12232 display module comes in several models, all using the same SED1520 controller. Operation and usage are identical, differing only in size. Commonly used models include MG-12232-5 (76×29.1×5.7mm), MG-12232-6 (45.05×22.32×6.3mm), and MG-12232-7 (84×44×10mm), which can be used on portable instruments or devices of varying sizes.
For LCD modules, the backlight type is also crucial, as different backlight types consume significantly different currents. Common backlight options include LEDs (Light Emitting Diodes), ELs (Electronic Luminescent Lamps), and CCFLs (Cold Cathode Fluorescent Lamps). ELs are surface-emitting cold light sources that can be made very large and thin. Although their brightness is lower, the light emission is very uniform and spotless, and their power consumption is particularly low. The disadvantage is that they require a high-voltage AC drive, necessitating a dedicated voltage conversion circuit (such as the IMP803). CCFLs offer a larger illumination area and are suitable for instruments or equipment requiring large LCD display interfaces.
III. Keyboard Interface
In addition to supporting input and output, the P1 and P2 ports of the MSP430F149 also support hardware interrupts. Each of the eight pins on ports P1 and P2 has its own control register, allowing for independent control and enabling of each pin as an interrupt source. Each pin can also individually select its interrupt trigger edge and enable interrupts. Ports P1 and P2 each use a single interrupt vector; pins P1.0 through P1.7 generate the same interrupt, and so do pins P2.0 through P2.7. This structure of ports P1 and P2 is well-suited for implementing interrupt-based keyboard input response programs.
This system uses a 2×2 matrix keyboard. The keyboard program uses a row scanning method. That is, P1.0 and P1.1 are connected to two column lines, which are defined as output ports, and P1.2 and P1.3 are connected to two row lines, which are defined as input ports. The two row lines need to be connected to 10K pull-up resistors.
To meet the system's low-power requirements, the keyboard input response program should be designed to run in interrupt mode. That is, when a key is pressed, an interrupt is generated to wake the MCU from sleep mode and start a 12ms timer. The MCU then returns to sleep mode. When the timer generates an interrupt again, it wakes the MCU from sleep mode, scans the keyboard, calculates the key value if a key is pressed, and executes the corresponding function program. After executing this program, the MCU returns to sleep mode.
IV. Principles and Some Program Examples of Chinese Character Display
1. Chinese character fonts for graphic dot matrix LCDs
Unlike displaying Chinese characters in DOS, graphic dot-matrix LCDs do not simply draw dots to represent Chinese characters. Character fonts extracted directly from the Chinese character library of a Chinese system cannot be displayed directly on the LCD; they usually require format adjustments and conversions. The arrangement of standard 16-dot-matrix Chinese character (such as HZK16 for the desired character) font data is shown in Figure 4.
Since an SED1520 display controller can control an 80×16 dot matrix LCD display, its display RAM consists of 16 rows, divided into 2 pages, with 8 rows per page. The 32 bytes of display RAM across 16 consecutive columns and 2 adjacent pages can control the display area of a Chinese character (as shown in Figure 5). Assigning corresponding values to these display RAMs will display a Chinese character.
As shown in Figures 4 and 5, the arrangement order and method of the Chinese character fonts in the SED1520 graphic dot matrix LCD display controller are completely different from those of the standard Chinese character fonts. The LCD font data can be obtained by performing bitwise operations on the standard font data.
In actual programming, the LCD font data of specific Chinese characters should be stored in the FLASH memory of the MSP430F149 microcontroller.
2. LCD Initialization Process
Before displaying information on the LCD, the LCD must be initialized. The initialization process is as follows:
It should be noted that although the SED1520 controller in the MG-12232 module actually controls 61 columns, when clearing the display RAM, it should still be cleared as 80 RAM units.
3. Some program examples
The program was written in assembly language on the IAR Embedded Workbench development platform for the MSP430 microcontroller, and the emulator used was TI's MSP-FET430P410.
Since this system uses the MSP430F149 microcontroller, the following settings need to be configured on the IAR Embedded Workbench platform before compiling the source code:
A. Click the Options… command under the Project menu to enter the settings window. In the Category box on the left, under the XLINK option, set the Include page and set the content of the XCL file name box to "C:\Program Files\IAR Systems\ew23\430\icc430\msp430F149A.xcl".
B. Click the Options… command under the Project menu to enter the settings window. In the Category box on the left, under the “C-SPY” option, set the “Setup” page and set the content of the “Chip Description” box to “C:\Program Files\IAR Systems\ew23\430\cw430\msp430F149.ddf”.
The following provides some constant definitions and the source code for the command sending subroutine (SEND_COM), data sending subroutine (SEND_DATA), and LCD status query subroutine (LCD_STE).
V. Conclusion
This system utilizes an MSP430F149 microcontroller, an MG-12232 graphic dot-matrix LCD module, and a matrix keyboard interface to construct a low-voltage, low-power Chinese human-machine interface based on a 3V level. In actual use, this human-machine interface consumes less than 1mA of current, and this design scheme achieves excellent low-power performance.