Design of a low-power Chinese human-machine interface based on MSP430 microcontroller

Publisher:睿智之光Latest update time:2012-02-17 Keywords:MSP430 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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

Keywords:MSP430 Reference address:Design of a low-power Chinese human-machine interface based on MSP430 microcontroller

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

Three typical reset circuits of MSP430 MCU
There are three typical reset circuits: (1) Connect a 100K ohm pull-up resistor to the RST/NMI pin. (2) Add a 0.1uf capacitor to (1) and ground one end of the capacitor to make the reset more reliable. (3) Based on (2), a diode of model IN4008 is connected in parallel with the resistor, which ca
[Microcontroller]
Three typical reset circuits of MSP430 MCU
STM32 drives LCD12864
#include "led.h" #undef APP_DE #include "hawk.h" LCD uses JLX19264G-260 from Jinglianxun Electronics #define FEEDDOG() GPIOC- ODR^= GPIO_Pin_0 //LCD IO initialization void LCD_Init(void) {    GPIO_InitTypeDef GPIO_InitStructure;    RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOD|RCC_APB2Periph_GPIOC|RCC_APB2Periph_GPIO
[Microcontroller]
LCD and LED: How to distinguish in three steps?
  Recently, on the Baidu Index, the search term "difference between LCD and LED " still ranks among the top ten. In view of the doubts of so many netizens about the distinction between the two, the editor has specially compiled the relevant knowledge about LCD and LED for everyone's reference and study.   1. Defini
[Power Management]
(Display) LCD1602 Program __ Version 2
LCD1602 has been used since I came into contact with microcontrollers. When I used it before, sometimes I used RS and EN, RW grounded, and sometimes used four-wire mode. But in the end, I found that it is best to use 8 data lines, RS, RW, EN are all connected to the microcontroller...   Proteus simulation diagram:
[Microcontroller]
(Display) LCD1602 Program __ Version 2
msp430 MCU timer Timer_A
Timer_A: Note: msp430 has two 16-bit timers Timer_A and Timer_B. They are basically the same. There are mainly several registers: TACTL, TAR, CCTL0, CCR0, CCTL1, CCR1, CCTL2, CCR2, TAIV. The most important one is the TACTL register, which determines the input clock signal of Timer_A, the working mode of Timer_A, t
[Microcontroller]
128*64 LCD display driver
  //Header file part #include reg52.h //======================================================= //Define common symbols, LCD control character symbol constants, TIME0 timing assignment constants #define uchar unsigned char #define uint unsigned int #define DISPON 0x3f #define DISPOFF 0x3e #
[Microcontroller]
MSP430 header file analysis
1. #define     BIT0               (0x0001)           //(0x0001) is not an address, but a hexadecimal value. Example 1: P3DIR |= BIT3; can actually be written as P3DIR |= 0x0008; which means to AND the default power-on value 0x0000 of the P3 port with 0x0008, and set the third pin of the P3 port (i.e. P3.3) for output.
[Microcontroller]
STM8 control LCD12864 LCD screen experiment
The first part of the parallel port transmission displays Chinese and English The main functions are as follows: First: write an LCD_write function to send data to the LCD. According to the timing diagram, to send data, RW must be set to 0, E must generate a falling edge, RS must be set to 1 for data, and RS must be s
[Microcontroller]
STM8 control LCD12864 LCD screen experiment
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号