Design of human-computer interaction system based on 51 single-chip microcomputer and FPGA

Publisher:老实巴交的大叔Latest update time:2011-11-18 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

In the development of modern instruments, human-computer interaction functions are playing an irreplaceable role. Instruments with user-friendly human-computer interaction interfaces will be easier to operate and use, thereby improving work efficiency. Liquid crystal displays (LCDs) have the characteristics of low power consumption, low price, long life, and convenient interface control, and are playing an increasingly important role in the field of scientific research and design. FPGA, as an interface chip for microcontroller peripherals, can greatly simplify the interface circuit. By programming FPGA, commonly used functions such as decoding and address gating can be realized.

This paper takes the C8051F020 microcontroller and FPGA interconnection system as the control core, takes the LCD display controller T6963C as an example, and combines it with the line scanning keyboard to briefly describe the design of a human-computer interaction function.

1 System design:

FPGA can greatly expand the resources of the MCU, but the human-computer interaction function should still minimize the consumption of MCU and FPGA resources, so that more on-chip resources can be used for the expansion of other functions. Using FPGA to scan the keyboard can save the resources of the MCU and can also flexibly expand the keyboard. Considering that the LCD control is more complicated, the MCU is still used to control the LCD, so that the various functions of the LCD can be used to the greatest extent. The system block diagram is shown in Figure 1.


2 Hardware circuit and FPGA interface design:

2.1 Bus interface design:

Here we use a system that interconnects the single-chip C8051F020 and the CycloneⅡ FPGA. The C8051F020 device is a fully integrated mixed-signal system-level MCU chip with 64 digital I/O pins. It is fully compatible with the 8051 and has greatly improved speed. 70% of the instructions are executed in 1 or 2 system clock cycles, and only 4 instructions are executed in more than 4 system clock cycles. In addition, the C8051F020 series MCU has several key improvements to the CIP-51 core and peripherals, which improves overall performance and makes it easier to use in the final application. For example, it provides 22 interrupt sources, 7 reset sources, programmable cross switches, 8-bit A/D converters, 12-bit D/A converters, etc.

The Cyclone II series FPGAs expand the density of low-power FPGAs to 68,416 logic units, and provide up to 622 available I/O interfaces and up to 1.1 Mb of on-chip storage units [3]. The Cyclone II series successfully combines high efficiency with low power consumption and can be used in automation, communications, video playback and other fields. In order to take into account the cost issue, this system uses the cost-effective EP2C8 FPGA as the interface device.

In order to maximize the development of the resources of the single-chip microcomputer, the high ports of the single-chip microcomputer, namely P4~P7, are connected to the FPGA, and the external devices are accessed through the FPGA. The 3-8 decoder is implemented in the FPGA through Verilog HDL language programming, thereby realizing the expansion of the single-chip microcomputer address bus. The 3-8 decoder provides an enable signal for the key value reading of the LCD and keyboard, as shown in Figure 2.

[page]

2.2 T6963C and its interface design:

The T6963C LCD controller is mostly used in small-scale LCD devices and is often assembled on graphic LCD modules in the form of a graphic LCD module with a built-in controller.

The microcontroller has two ways to access T6963C: direct access and indirect access. Direct access uses three buses to control I/O device access; indirect access is controlled by the microcontroller providing a parallel interface and controlled by program-controlled timing. To simplify the program, direct access is used here.

The FS1 pin of this LCM is used to control the font of the displayed characters. When FS1 is high, the LCD displays 6×8 characters; when FS1 is low, the LCD displays 8×8 characters. Through practice, 6×8 characters are more beautiful when displaying English and numbers; 8×8 characters are more convenient when displaying Chinese characters. The general system uses the method of grounding or connecting FS1 to a high position to fix the font, while this system uses P2.1 to control FS, and the function of changing the font is realized by changing the address, making the interface display more flexible.

2.3 Keyboard circuit design:

The keyboard is a commonly used single-chip microcomputer input device, which is divided into coded keyboard and non-coded keyboard. The recognition of the closed key on the keyboard is realized by a dedicated hardware decoder, and the key number or key value is generated, which is called a coded keyboard; the keyboard that is recognized by software is called a non-coded keyboard. The most commonly used non-coded keyboard in the measurement and control system composed of single-chip microcomputers and intelligent instruments is the non-coded keyboard. This system design is programmed in FPGA to realize the row scanning of 3×6 keyboards.

Due to the mechanical characteristics of the key, there will be a series of jitters at the moment of closing and opening. The jitter of the key will cause a key to be misread multiple times, so de-jittering must be performed. The commonly used method is delay de-jittering. After the FPGA generates the key value, it sends an interrupt to the microcontroller and waits for the microcontroller to read the key value. Since the human brain has a relatively long reaction time, the keyboard interrupt can be at a relatively low priority, so this article connects the keyboard interrupt to the external interrupt 7.

3. Software Design:

The software design follows the principles of structured and hierarchical design. The bottom-level functions communicate directly with the hardware, while the upper-level functions directly call the bottom-level functions to implement the corresponding functions, thus completely separating the upper-level functions from the hardware environment. When the hardware environment changes, the program can be transplanted by simply modifying the bottom-level functions.

3.1 Programming design of LCD driver module:

The bottom layer functions of this module need to implement functions such as writing control words, writing parameters, and checking busy. Due to the direct access, the functions of writing control words and writing parameters only need to send numbers to the address of the control port or data port. Since LCD is a slow device, a busy check is required before each writing of control words and parameters. The status word of T6963C has a total of 7 valid status bits, as shown in Table 1. Among them, STA1~STA3 are the most commonly used, and under normal circumstances, there is no need to check the busy program for STA5~STA7.


3.1.1 Initialization of LCD driver module:

The biggest feature of T6963C is its unique hardware initial value setting function, which displays the parameters required by the driver, such as the duty cycle coefficient. The number of bytes/lines transmitted by the driver and the font selection of characters are all set by the pin level, so that the initialization of T6963C is basically set when it is powered on, and the focus of software operation can be fully used on the design of the display screen. Therefore, during initialization, you only need to set the first address and width of the text area and graphic area according to the actual situation, as well as the CGRAM offset address, synthesis method, cursor shape, etc., and it can be used normally.

The initialization function of the LCD driver module is as follows:

void LcdInitial(void)

{

LcdWriteDataD(0x00,0x00,0x40); //Set the first address of the text area to 0000H

LcdWriteDataD (0x20, 0x00, 0x41); //Set the text area width to 20H bytes

LcdWriteDataD(0x00,0x04,0x42); //Set the first address of the graphics area to 0400H

LcdWriteDataD(0x20,0x00,0x43); //Set the width of the graphics area to 20H bytes

LcdWriteDataD(0x03,0x00,0x22); //Set CGRAM offset address, the first address of display memory is 1800H

LcdWriteDataN (0xa7); //Set the cursor shape to 8×7

LcdWriteDataN (0x80); // Enable the internal character generator, logical "or" synthesis

LcdWriteDataN (0x9c); // Enable text and graphic display, disable cursor

LcdClear(3); //Clearing

}

3.1.2 Text display in English and Chinese characters:

Since the fonts of commonly used characters such as English and numbers have been solidified in CGROM, when displaying English, you only need to specify the display address and then enter the label corresponding to the character. The display of Chinese characters is similar to that of English. However, due to its complexity, a Chinese character requires 4 sets of dot matrices to be fully displayed. After initialization, the 4 parts of the Chinese character font are sequentially input into CGRAM. When using it, you only need to calculate the display address of each part to display the Chinese character perfectly.

For the input of a string of English characters, the characteristics of the string can be used for operation. By detecting the '' character to determine the end of the English string, the work of manually calculating the length of the sentence when calling this display function is avoided. The ASCII code value of the English character and its corresponding label in the CGROM are exactly 0x20 different, so only a simple subtraction is required to achieve the conversion of the label. In addition, when performing continuous display of English, the automatic data write instruction of T6963C is used to improve the display efficiency.

To display a string of Chinese characters, you only need to call a single Chinese character display program in a loop. Note that because the string in C51 language cannot support Chinese characters, the length of the Chinese character string must be calculated manually and passed to this display function as a function. [page]

A total of 32 Chinese characters can be stored in the character generator CGRAM. For applications that need to display more Chinese characters, the 16 most commonly used Chinese characters can be selected from the characters to be displayed and stored in the CGRAM. The remaining Chinese characters are only dynamically written to the CGRAM when they are needed. In this way, the display efficiency is improved and the problem of too small CGRAM is solved.


3.1.3 Graphical display:

In addition to using text to display Chinese characters, you can also use graphic display. The specific method is to save the font in the code segment of the microcontroller in the form of an array, and send the data to the graphic area when it needs to be displayed. In addition, using graphic display, you can also write a point drawing program to display the corresponding waveform or write a drawing program to draw a simple table, so that the system display results are more intuitive and easy to analyze.

3.1.4 Text effects:

T6963C can set the text attribute area and implement special effects such as reverse white, forward flashing, and reverse flashing for the text. When using it, just set the graphic display to the text attribute area. At this time, the content of the graphic area will not be displayed. If the graphic area and the text attribute area are divided into different areas of CGRAM, the content of the graphic area can be saved. With text special effects, the optional options and the current options can be indicated through effects such as reverse white or flashing, making the interface easier to operate.

3.2 Human-computer interaction interface design:

In addition to the basic 10 numeric keys, there are also up, down, left, right, confirm, cancel and other keys. In addition, the design of the key positions is more in line with people's key habits. A hierarchical menu is used in the interface. After selecting a function in the first-level menu, you will enter the next-level menu to set the function in more detail. In the human-computer interaction interface, you can use the direction keys to select functions, and the numeric keys are only used for data input.

The interface makes full use of text effects. The reverse display of options indicates that the option has been selected; the reverse flashing of options indicates that users can change options through the arrow keys. In the interface that requires numeric input, the cursor is turned on to indicate the place for numeric input to the user. In addition, the design of necessary warning and error interfaces will provide users with more information, making the human-computer interaction interface more user-friendly.

4 Conclusion:

This system uses keyboard + LCD input and output devices, and can realize the design of interface circuits of various other peripherals through FPGA, which reduces the occupation of single-chip microcomputer resources and makes the design flexible and convenient. At the same time, FPGA can also provide resources such as memory and I/O ports for single-chip microcomputer. The circuit designed in this paper has strong scalability, and on this basis it can be expanded into various systems with friendly interfaces, such as controllable gain amplifier, audio signal analyzer, integrated operational amplifier analyzer, etc. In practice, the system is stable, easy to use and practical.


Reference address:Design of human-computer interaction system based on 51 single-chip microcomputer and FPGA

Previous article:Design of Ultrasonic Distance Measurement System Based on 51 Single Chip Microcomputer
Next article:Interface Design between 51 MCU and TLV2548 Serial A/D

Recommended ReadingLatest update time:2024-11-16 15:43

Low frequency digital phase measuring instrument based on AVR microcontroller and FPGA
Abstract: A system design scheme based on AVR ATmega128 microcontroller and Altera's Cyclone series EP1C3T100 is proposed. The measurement principle and measurement error of the digital low-frequency phase meter and the method of eliminating them are analyzed. The powerful computing and control functions of the mi
[Embedded]
Low frequency digital phase measuring instrument based on AVR microcontroller and FPGA
Design of human-computer interaction system based on single chip microcomputer and FPGA
    In the development of modern instruments, human-computer interaction functions are playing an irreplaceable role. Instruments with friendly human-computer interaction interfaces will be easier to operate and use, thereby improving work efficiency. Liquid crystal displays (LCDs) have the characteristics of low powe
[Microcontroller]
Design of human-computer interaction system based on single chip microcomputer and FPGA
Implementation of Remote Detection System for FPGA Development Board
1 System Overview Currently, the onboard resource detection of FPGA development boards adopts the method of downloading examples to the development board for detection. Different examples are generally used to detect different resources. This detection method lacks the collection of detection result information. It is
[Test Measurement]
Implementation of Remote Detection System for FPGA Development Board
Implementation of high-speed fixed-point FFT algorithm based on FPGA
Introduction Fast Fourier Transform (FFT) is a computing and analysis tool that is widely used in many disciplines (such as signal processing, image processing, bioinformatics, computational physics, applied mathematics, etc.). In the field of high-speed digital signal processing, such as radar signal processing
[Test Measurement]
Implementation of high-speed fixed-point FFT algorithm based on FPGA
FPGA Design and Simulation of Quadrature Amplitude Modem
Abstract: Quadrature amplitude modulation (QAM) is a relatively efficient channel modulation technology in terms of power and bandwidth, so it has been widely used in channel modulation technology. The FPGA implementation of its carrier signal generally adopts the lookup table method, which consumes a lot of ROM res
[Industrial Control]
FPGA Design and Simulation of Quadrature Amplitude Modem
Research and development of power battery management system based on FPGA
The safety, cost and driving range of automotive power batteries have always been the main factors affecting the promotion and application of electric vehicles. Based on the existing battery technology, an effective battery management system can protect automotive power batteries, extend their service life, increase
[Embedded]
Research and development of power battery management system based on FPGA
The hardware platform based on ARM and FPGA realizes an embedded CNC system with high openness characteristics.
introduction In the existing CNC system, the computer CNC system solution of industrial computer plus motion control card is mostly used to design the motion controller. As the overall functions of industrial computers become increasingly complex, the requirements for motion control systems in terms of volume, cost, a
[Microcontroller]
The hardware platform based on ARM and FPGA realizes an embedded CNC system with high openness characteristics.
Demodulation error tester based on FPGA and pre-distortion technology
1 Introduction In engineering practice, we often need to perform design verification on the designed hardware circuit to ensure its normal operation, so as to further support the correct debugging of complex programs based on the hardware. In this way, the design of a specific corresponding test system is part
[Test Measurement]
Demodulation error tester based on FPGA and pre-distortion technology
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号