Design of Human-Computer Interaction System Based on 51 Single-Chip Microcomputer and FPGA

Publisher:等风来88888Latest update time:2011-11-16 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 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 scientific research and design. FPGA, as an interface chip for microcontroller peripherals, can greatly simplify the interface circuit. By programming the FPGA, commonly used functions such as decoding and address gating can be realized.
This article takes the C8051F020 microcontroller and FPGA interconnection system as the control core, takes the liquid crystal display controller T6963C as an example, and combines the line scanning keyboard to briefly describe the design of a human-computer interaction function.

1 System Design Scheme
FPGA can greatly expand the resources of the microcontroller, but the human-computer interaction function should still minimize the resource consumption of the microcontroller and FPGA, so that more on-chip resources can be used for the expansion of other functions. Using FPGA scanning keyboard can save the resources of the microcontroller and also flexibly realize the expansion of the keyboard. Considering that LCD control is relatively complex, a single-chip microcomputer is still used to control
the LCD so that the various functions of the LCD can be utilized to the maximum extent. The system block diagram is shown in Figure 1.

a.JPG


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 take 1 or 2 system clock cycles to execute, and only 4 instructions take more than 4 system clock cycles to execute. In addition, the C8051F020 series MCU has several key improvements to the CIP-51 core and peripherals, which improves the 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Ⅱ series FPGA expands the density scale of low-power FPGAs to 68,416 logic units, and provides up to 622 available I/O interfaces and up to 1.1 Mb of on-chip storage units. The CycloneⅡ series successfully combines high efficiency and low power consumption, and can be used in automation, communication, 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. [page]

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 Vel-ilog HDL language programming, thereby expanding the address bus of the single-chip microcomputer. The 3-8 decoder provides an enable signal for the key value reading of the LCD and keyboard, as shown in Figure 2.

b.JPG


2.2 T6963C and its interface design
The T6963C liquid crystal display controller is mostly used for small-scale liquid crystal display devices. It is often assembled on graphic liquid crystal display modules and appears in the form of built-in controller type graphic liquid crystal display modules.
The microcontroller has two ways to access T6963C: direct access and indirect access. Direct access uses three buses to control in the form of I/O device access; indirect access is controlled by the microcontroller providing a parallel interface and controlled in the form of program control timing. To simplify the program, direct access is used here.
The FS1 pin of the LCM is used to control the font of the displayed characters. When FS1 is high, the LCD displays 6x8 characters; when FS1 is low, the LCD displays 8x8 characters. According to practice, when displaying English and numbers, 6x8 characters are more beautiful; when displaying Chinese characters, 8x8 characters are more convenient. The general system uses the method of grounding or connecting FS1 to a high level 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 and intelligent instruments composed of single-chip microcomputers is the non-coded keyboard. This system design is programmed in FPGA to implement the row scan of the 3x6 keyboard.
Due to the mechanical characteristics of the key, there will be a series of jitters at the moment of closing and opening. The key jitter will cause a key to be misread multiple times, so de-jitter processing must be performed. The commonly used method is delayed de-jitter. After the FPGA generates the key value, it sends an interrupt to the single-chip microcomputer and waits for the single-chip microcomputer to read the key value. Because 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
Software design follows the structured and hierarchical design principles. The bottom-level function communicates directly with the hardware, and the upper-level function directly calls the bottom-level function to implement the corresponding function, so that the upper-level function is completely separated from the hardware environment. When the hardware environment changes, only the underlying functions need to be modified to achieve program migration.
3.1 Programming design of LCD driver module
The underlying functions of this module need to implement functions such as writing control words, writing parameters, and checking busy. Due to the use of 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.

c.JPG

[page]

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 the 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 in the design of the display screen. Therefore, during initialization, you only need to set the first address and width of the text area and the graphic area according to the actual situation, as well as the CGRAM bias address, synthesis method, cursor shape, etc., and it can be used normally.
The initialization function of the LCD driver module is as follows:
d.JPG
e.jpg
3.1.2 Text display of 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 matrix to be fully displayed. After initialization, the four 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, you can use the characteristics of the string to operate. By detecting the '\0' character to determine the end of the English string, you can avoid the work of manually calculating the length of the sentence when calling this display function. The ASCII code value of the English character and its corresponding label in CGROM are exactly 0x20 different, so only a simple subtraction is required to achieve the label conversion. In addition, when displaying English continuously, the data automatic write instruction of T6963C is used to improve the display efficiency.
For the display of a string of Chinese, it is only necessary to implement it by cyclically calling a single Chinese display program. Note that since the string in the C51 language cannot support Chinese, the length of the Chinese string must be manually calculated and passed as a function to this display 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 into the CGRAM when they are needed. This not only improves the display efficiency, but also solves the problem of too small CGRAM.

f.jpg


3.1.3 Graphic Display
In addition to using text to display Chinese characters, graphic display can also be used. 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 special 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. Using text special effects, the optional options and the current options can be indicated by reverse white or flashing effects, making the interface easier to operate.
3.2 Human-computer interaction interface design
In addition to the basic 10 numeric keys, up, down, left, right, confirm, cancel and other keys are also set. In addition, the design of the button position is more in line with people's button habits. The interface uses a hierarchical menu. 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 arrow keys to select functions, and the number keys are only used for data input.
The interface makes full use of text effects. The reverse display of the option indicates that the option has been selected: the reverse flashing of the option indicates that the user can change the option through the arrow keys. In the interface where digital input is required, the cursor can be turned on to indicate the place for digital 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 friendly.

4 Conclusion
This system uses keyboard + LCD input and output devices, and can realize the design of various other peripheral interface circuits through FPGA, reducing the occupation of single-chip microcomputer resources, making the design flexible and convenient. At the same time, FPGA can also provide resources such as memory and I/O ports for the single-chip microcomputer. The circuit designed in this paper has strong scalability. 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 displacement measurement device based on 51 single chip microcomputer and FPGA
Next article:Industrial Sequential Control Based on 8031 ​​Design

Recommended ReadingLatest update time:2024-11-16 19:32

Design of a Color Image Enhancement System Based on FPGA
In the process from image source to terminal display, circuit noise, transmission loss, etc. will cause image quality to deteriorate. In order to improve the visual effect of the display, image enhancement processing is often required. Image enhancement processing is highly targeted and there is no unified evaluatio
[Embedded]
Design of a Color Image Enhancement System Based on FPGA
Design of embedded data acquisition system using ARM/FPGA master-slave processor
With the development of people's interest in high altitude and the need for research, more and more scientific experiments have been moved to the air by researchers, and balloon sounding and drone experiments are relatively typical methods. These scientific experiments often need to trigger a specific experimental p
[Microcontroller]
Design of embedded data acquisition system using ARM/FPGA master-slave processor
Bayer format image preprocessing based on FPGA+DSP technology
Real-time processing of high-resolution images has been widely used and developed in the fields of communications, medicine, military, aerospace, information security, etc. In the process of real-time image processing, the lower layer Image preprocessing has a large amount of data and simple calculati
[Security Electronics]
Bayer format image preprocessing based on FPGA+DSP technology
Power ICs required for the latest FPGAs provide space for electronics diversification
In recent years, the diversification and high performance of electronic devices (applications) have been developing at an astonishing speed. It can be said that this trend has shortened the development cycle of each product and brought huge development space to semiconductor technology. Against this backdrop, LSIs ca
[Power Management]
Power ICs required for the latest FPGAs provide space for electronics diversification
Design of motion estimation based on FPGA
Abstract: A motion estimation design for video images is implemented using a powerful FPGA. The search method used is a three-step search method. When designing the scheme, this paper uses the relatively mature VHDL language for design, and uses Quartus II software for timing simulation. From the simulation results,
[Embedded]
Design of motion estimation based on FPGA
Design and Application of MSK Modem Based on FPGA
Digital modems have been widely used in point-to-point data transmission. Conventional binary digital modems are based on analog carriers, and require analog signal sources when implementing the circuit, which brings inconvenience to all-digital applications. This paper analyzes the characteristics of MSK (m
[Embedded]
Design and Application of MSK Modem Based on FPGA
FPGAs: the fundamental building blocks for next-generation automotive designs
Automotive technology is in the ascendant.  A few years ago, there was a lot of buzz surrounding fully autonomous driving, but technological development in the real automotive world has tended to be quiet. People are now more pragmatic and want to discuss which technologies can bring more meaningful value to cars no
[Automotive Electronics]
FPGA-based chip design and its application
In the past, the semiconductor industry has always focused on two goals: reducing size and increasing speed. For nearly 40 years, the pursuit of these goals has driven the industry to develop in line with Moore's Law, with performance and circuit density doubling every 18 months. This has led to rapid technological
[Embedded]
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号