In modern portable intelligent instruments or handheld devices, Chinese human-machine interface has become a de facto industry standard. Graphic dot matrix LCD that can display Chinese characters and small keyboard that can input numbers have become an indispensable part of intelligent devices. At the same time, the low power consumption characteristic, which is the basic requirement of portable devices, also runs through the design of Chinese human-machine interface.
This kind of low-power Chinese human-machine interaction interface requires designers to have special considerations in selecting MCU and specific components. Micro power consumption and small size should be the primary requirements for selecting related components.
In the design, the author uses MSP430F149 microcontroller as the MCU of the system, and builds a low-power Chinese human-machine interface at 3V level by selecting a suitable LCD display module. This Chinese human-machine interface constitutes an important part of the micro-power data acquisition system.
1. Micro power consumption characteristics of MSP430 series FLASH microcontrollers
The MSP430F14x series launched by Texas Instruments (TI) is an ultra-low power Flash-based 16-bit RISC instruction set microcontroller. It adopts the "von Neumann" structure, and the RAM, ROM and all peripheral modules are located in the same address space. It has a rich on-chip peripherals and is extremely cost-effective.
The MSP430F14x series is the most powerful sub-series of TI's MSP430F1x series (FLASH memory type) microcontrollers. The F14x has a larger program and data storage area, more peripheral modules, and even includes a hardware multiplier on the chip. At the same time, the F14x series microcontroller development tools are simple, and the programs solidified in the FLASH memory are easy to upgrade and debug online, making it very suitable for the development of consumer portable electronic products.
The MSP430F14x MCU embodies the advanced low-power design concept of modern MCUs. Its design structure is completely based on the low-power operation of the system.
This low power structure is specifically reflected in the following four points:
(1) Highly integrated, fully monolithic design.
Many peripheral modules are integrated into the MCU chip to increase hardware redundancy. The internal design is based on the principles of low power consumption and low voltage. This system is not only powerful, reliable, and cost-effective, but also easy to further miniaturize and portability.
(2) The internal circuit can work selectively.
The F14x microcontroller can select to use different functional circuits through special function registers, that is, rely on software to select different peripheral function modules, and stop the unused modules to reduce invalid power consumption.
(3) It has two sets of clocks, high speed and 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 sub-clock can be selected to run at a low speed to further reduce power consumption. The CPU clock frequency can be changed by assigning values to special function registers through software, or the main clock and sub-clock can be switched.
(4) It has multiple energy-saving working 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 working current consumed in the active state (AM) and various energy-saving modes.
Figure 1 Relationship between F14x's operating mode and operating current
Since the MSP430F14x series is specially developed for ultra-low power portable applications, using advanced integrated circuit technology and production processes, its power consumption has surpassed the milliampere level and truly entered the microampere level.
In addition, the software structure of F14x is also designed for low power consumption. For example, it takes only 6μS to wake up the MCU from standby mode. There is no hierarchical limit on interrupt and subroutine calls. This rich interrupt capability reduces the need for system query and can easily design a control program with an interrupt program structure.
Using the F14x series of microcontrollers, you can easily build a low-voltage working platform. By combining the intelligent operation management of each functional module with the energy-saving mode of the MCU, the contradiction between operating speed, data flow and low-power design can be resolved, the current consumption of each functional module can be reduced to the lowest state, and the activity state can be limited to the minimum requirement. After such optimization, the extremely low power consumption of the microcontroller can be achieved. For example, at a working frequency of 1MHz, F14x only consumes 0.1~400μA current (1.8~3.6V power supply). When powered by 1.8V, it only consumes 160uA of current during execution and 0.1uA during standby. At this time, the data in the RAM can still be effectively maintained.
In summary, the MSP430F14x microcontroller has extremely low power consumption, powerful processing capabilities, rich on-chip peripheral modules, and convenient and efficient development methods.
The MSP430F149 microcontroller used in this system is the most powerful one in the F14x series. It has a hardware multiplier, 6 I/O ports (each with 8 I/O ports), 1 accurate analog comparator, 2 timers with capture/compare registers, 8-channel 12-bit A/D converter, on-chip watchdog timer, 2 serial communication interfaces, 60KB FlashROM, and 2KB RAM.
F149 also has powerful expansion functions. It has 48 I/O pins. Each I/O port corresponds to multiple registers such as input, output, function selection, interrupt, etc., so that the function port and general I/O port can be reused, which greatly enhances the port function and flexibility and improves the ability to develop peripheral devices.
The above features of MSP430F149 make it very suitable for forming a full-function portable microcontroller application system.
2. LCD display module and interface circuit
Graphic dot matrix LCD can display any user-defined symbols and graphics, and can scroll to display. As an important component of the human-computer interaction interface of portable single-chip microcomputer systems, it is widely used in real-time detection and display instruments. Graphic dot matrix LCD that supports Chinese character display is a very common display device in modern single-chip microcomputer application systems. The display screens on Chinese character BP machines and mobile phones are graphic dot matrix LCDs. It and the determinant keypad form the most commonly used human-computer interaction interface in modern single-chip microcomputer application systems.
Compared with other display methods, the use of graphic dot matrix liquid crystal display has the following main advantages:
(1) Low operating voltage and extremely low power consumption. The operating voltage is 3~5V, and the operating current is ≤10uA/cm2. It is particularly suitable for portable instruments and meters.
(2) Liquid crystal display is a passive display and is less affected by external light.
(3) Graphic dot matrix liquid crystal can display a large amount of information and has high resolution.
(4) It does not generate electromagnetic interference.
(5) High reliability. Long service life.
In the design, the author used the MG-12232 LCD display module from TRULY. The typical value of the MG-12232 module power supply voltage is 3V, and the typical value of the working current is 0.3mA, which is very suitable for the low-power environment of the 3V level of this system. Its display range is 122×32 dot matrix, which can realize the so-called "double-row Chinese display". The controller used by MG-12232 is two SED1520s, and one SED1520 controller can drive 16 rows×80 columns. The SED1520 controller can work normally under 3V logic, thus avoiding the problem of mismatching the logic level of the MSP430 microcontroller. Its specific structure block diagram is shown in Figure 2.
Figure 2 Pin definition and structure diagram of SED1520
The SED1520 controller is used as the interface between the LCD screen and the MCU. It directly drives the MG-12232 LCD to control the display of characters, Chinese characters, and graphics. Since the MSP430F149 has 48 I/O pins, with the help of SED1520, the I/O port of the MSP430 can be used to simulate the reading and writing of the LCD and the control timing. The operation of the MCU on the LCD actually becomes the operation of the MCU on the LCD display controller SED1520, so the hardware connection and software programming of the interface circuit are much simpler.
The "V5" pin in Figure 2 provides the contrast voltage of the MG-12232 LCD. It can be generated by a -12V voltage generating circuit (such as MAX765) and can be used after being divided by a 100K potentiometer.
MCU can access the LCD module through some control pins of SED1520 and 13 common instructions. For example, "RST" is used to restart SED1520, "E1" and "E2" are used to enable two SED1520s respectively. "R/W" controls the reading or writing of SED1520. "A0" determines whether the operation is instruction reading or writing or data reading or writing.
A SED1520 display controller can control the display of 80×16 dot matrix LCD. Its display RAM has 16 rows in total, divided into 2 pages, 8 rows per page, and the data registers of each page correspond to 8 rows of dots on the LCD screen. When the page address and column address are set, the unique unit in the display RAM is determined. Each column on the screen corresponds to a byte content of the display RAM, and the bottom bit of each column is the MSB, and the top bit is the LSB, that is, each data bit of the RAM unit byte data from low to high corresponds to the 8 data bits from high to low of a column on the display screen. Assigning a value to a byte unit of the display RAM is to control whether the 8 rows (one page) of pixels in the current column are displayed.
As shown in Figure 3, the P5 port of the MSP430F149 microcontroller is used as the data port for communicating with the LCD display module.
Figure 3 Circuit connection diagram of MSP430F149 and MG-12232
There are multiple models of MG-12232 display module. Different models use the same SED1520 controller, and the operation and use methods are exactly the same, but the size is different. Commonly used ones include MG-12232-5 (76×29.1×5.7mm), MG-12232-6 (45.05×22.32×6.3mm), MG-12232-7 (84×44×10mm), etc., which can be used on portable instruments or equipment of different sizes.
For LCD display modules, it is also necessary to focus on the backlight type. Different backlight types consume very different currents. Generally, the optional backlight types are LED (light emitting diode), EL (electroluminescent lamp) and CCFL (cold cathode lamp). EL is a cold light source that emits light on a surface. It can be made very large and thin in structure. Although the brightness is low, the light is very uniform and has no light spots, especially the power consumption is very low. The disadvantage is that it requires a high-voltage AC voltage to drive, so a special voltage conversion circuit (such as IMP803) is required. CCFL has a larger lighting area and is suitable for instruments or equipment that require a large-area LCD display interface. [page]
3. Keyboard interface
In addition to supporting input and output, the P1 and P2 ports of the MSP430F149 also support hardware interrupts. The 8 pins of the P1 and P2 ports have their own control registers. Each pin can be controlled individually, and each pin can be used as an interrupt source. Each pin can select the interrupt trigger edge and allow interrupts individually. The P1 and P2 ports each use an interrupt vector. P1.0~P1.7 generate the same interrupt, and P2.0~P2.7 also generate the same interrupt. This structure of the P1 and P2 ports is very suitable for implementing interrupt-based keyboard input response programs.
This system uses a 2×2 row-column keyboard. The keyboard program uses the 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.
Considering the low power consumption requirement of the system, 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 up the MCU from sleep mode, and a 12ms timer is started, and then the MCU enters sleep mode again. When the timer generates an interrupt, the MCU is woken up from sleep mode again, and the keyboard is scanned at this time. If a key is pressed, the key value is calculated and the function program corresponding to the key value is executed. After executing the program, the MCU enters sleep mode again.
4. Principles of Chinese Character Display and Some Program Examples
1. Chinese character fonts for graphic dot matrix LCD
Unlike displaying Chinese characters in DOS, graphic dot matrix LCD does not simply draw Chinese characters by drawing dots. Chinese character fonts directly extracted from the Chinese system Chinese character library cannot be directly displayed on the LCD, and usually must be adjusted and converted in format. The arrangement of the font data of standard 16-dot matrix Chinese characters (such as HZK16 of Hope Chinese characters) is shown in Figure 4.
Since a SED1520 display controller can control the display of 80×16 dot matrix LCD, its display RAM has 16 rows in total, divided into 2 pages, 8 rows per page. 16 consecutive columns of 2 adjacent pages of 32-byte display RAM can control the display area of a Chinese character (as shown in Figure 5). Assigning corresponding values to these display RAMs can display a Chinese character.
Figure 4: Standard Chinese character font arrangement Figure 5: SED1520 Chinese character font arrangement
As shown in Figures 4 and 5, the arrangement order and method of the Chinese character fonts of the SED1520 graphic dot matrix LCD display controller are completely different from the standard Chinese character fonts. The LCD font data can be obtained by performing bit 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 display initialization process
Before the LCD displays information, it must be initialized.
The initialization process is as follows:
It should be noted that although the actual control area of a SED1520 controller in the MG-12232 module is 61 columns, when clearing the display RAM, it should still be cleared according to 80 RAM units.
3. Some program examples
The program is written in assembly language under the development platform IAR Embedded Workbench of MSP430 microcontroller, and the simulator uses MSP-FET430P410 of TI Company.
Since the MSP430F149 microcontroller is used in this system, the following settings need to be made on the IAR Embeded WorkBench platform before compiling the source program:
A. Click Options… in the Project menu to enter the settings window. Set the "Include" page under the "XLINK" option in the Category box on the left. Set the content of the "XCL file name" box to "C:\Program Files\IAR Systems\ew23\430\icc430\msp430F149A.xcl".
B. Click Options… in the Project menu to enter the setup window. Set the "Setup" page under the "C-SPY" option in the Category box on the left. Set the content of the "Chip Description" box to "C:\Program Files\IAR Systems\ew23\430\cw430\msp430F149.ddf".
The following gives some constant definitions and the source code of the send command word subroutine (SEND_COM), send data subroutine (SEND_DATA) and LCD status query subroutine (LCD_STE).
#include "msp430x14x.h"
;The program displays "Chinese characters LCD" on the LCD.
;---------Define LCD pins
LCD_RST EQU 04H ;P4.2
LCD_E1 EQU 40H ;P4.6
LCD_E2 EQU 20H ;P4.5
LCD_RW EQU 10H ;P4.4
LCD_A0 EQU 08H ;P4.3
;----------Define data registers used by
LCD LCD_PAGE EQU 0200h ;Define display page
LCD_ORDER EQU 0201h ;Temporarily store LCD control instructions
LCD_DATA EQU 0202h ;Temporarily store LCD data
LCD_CNT EQU 0203h ;LCD counter memory
LCD_ROW EQU 0204h ;Store column address data
LCD_LINE EQU 0205h ;Store row address data
LCD_CHAR EQU 0206h ;Store the first address of the current character data
LCD_BYTECNT EQU 0207h ;Store the number of bytes to be displayed
LCD_STATUS EQU 0208h ;Store the data of the current status of the LCD
SEND_COM ;Send command word subroutine, with LCD_ORDER as the entry parameter
BIS.B #LCD_E1,&P4OUT ;SET E1=1 ,Enable CHIP1
CALL #LCD_STE
BIC.B #LCD_A0,&P4OUT ;A0=0,SEND OUT INSTRUCTION
BIC.B #LCD_RW,&P4OUT ;R/W=0,WRITABLE
BIS.B #0FFH,&P5DIR ;SET P5 PINS OUTPUT
MOV.B LCD_ORDER,&P5OUT ;SEND ORDER BYTE TO LCD
BIC.B #LCD_E1,&P4OUT ;SET E1=0
RET
;Send data subroutine, with LCD_DATA as the entry parameter
SEND_DATA BIS.B #LCD_E1,&P4OUT ;SET E1=1
CALL #LCD_STE
BIS.B #LCD_A0,&P4OUT ;A0=1,SEND OUT DATA
BIC.B #LCD_RW,&P4OUT ;R/W=0,WRITABLE
BIS.B #0FFH,&P5DIR ;SET P5 PINS OUTPUT
MOV.B LCD_DATA,&P5OUT ;SEND DATA BYTE TO LCD
BIC.B #LCD_E1,&P4OUT ;SET E1=0
RET
;Subroutine to read the current status of LCD LCD_STE
LCD_STE BIC.B #LCD_A0,&P4OUT ;A0=0,SEND OUT INSTRUCTION
BIS.B #LCD_RW,&P4OUT ;R/W=1,READABLE
BIC.B #0FFH,&P5DIR ;SET P5 PINS INPUT
STE_AGN MOV.B &P5IN,LCD_STATUS ;GET STATUS DATA FROM LCD
BIT.B #80H,LCD_STATUS ;If the status memory bit 7 is 1, busy, then wait for
JC STE_AGN
RET
V. Conclusion
This system uses MSP430F149 single-chip microcomputer, MG-12232 graphic dot matrix LCD module and row-column keyboard interface to build a low-voltage, micro-power Chinese human-machine interface based on 3V level. In actual use, the current consumption of this human-machine interface is less than 1mA, and this design scheme has achieved good micro-power consumption effect.
References
1. MSP430 Series FLASH Ultra-Low Power 16-bit MCU, Hu Dake, Beijing University of Aeronautics and Astronautics Press, 2001
2. MSP430x1xx Family User's Guide, 2000
3. MSP430x13x, MSP430x14x Data sheet, 2000
Previous article:Using MSP430F133 MCU to transform old measuring instruments
Next article:Design of MSP430 Mixed Voltage and Logic System
Recommended ReadingLatest update time:2024-11-16 15:40
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Data centers, high-performance computing, consumer electronics products - these testing solutions are all here, waiting for you!
- KiCad RF Tools
- MC34063 step-down circuit
- Disassemble a Hall three-axis joystick
- Review of the concepts of intrinsic semiconductors and PN junctions
- Join the stm32 development team, increase friendship and increase income...
- EEWORLD University Hall----Live Replay: TI's Industry's Most Accurate 3D Hall Effect Position Sensor
- The STM8S003 program disappears easily
- (nand) sd boot
- EEWORLD University Hall----Live Replay: Introduction and Application of C2000? Built-in Programmable Logic Module CLB