Keyboard display circuit composed of 87LPC76x single chip

Publisher:京玩儿Latest update time:2012-02-17 Source: 电子设计应用 Keywords:MCU Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

In some intelligent instruments, the human-machine interface is usually an LED digital tube display and a small keyboard. There are two common working methods: one is to directly use the CPU in the system to dynamically scan the display and detect the keyboard. In order to ensure the stability of the display and the timely response of the keyboard, the CPU needs to frequently execute the dynamic scanning program, which is obviously not suitable when the CPU is busy; the other is to use dedicated display and keyboard chips such as 8279, SAA1064, etc. These chips are always inconvenient in practical applications for various reasons, such as the number of bits that can be displayed is small and the price is high. Phlips' P87LPC76X series of microcontrollers belong to the 51 series. They are small in size, powerful in function, low in price, and have a high cost performance. This article introduces a display and keyboard circuit with certain versatility composed of this series of microcontrollers.

Figure 1 Hardware circuit diagram

Introduction to P87LPC76X MCU

The P87LPC76X microcontrollers include P87LPC760, P87LPC761, P87LPC762, P87LPC764, P87LPC767, P87LPC768, etc. The chip uses an accelerated 51 core. At the same clock frequency, its speed is twice that of the standard 51. Except for the number of pins, memory capacity and some special I/O functions, most of their functions are the same. The following takes 87LPC762 as an example. 87LPC762 is a 20-pin package with 2KB of program memory, 128B of data memory, two 16-bit timers/counters, a standard serial communication port, an I2C interface, and an internal oscillator, power-on reset and watchdog circuit. When using its internal oscillator and power-on reset circuit, there can be up to 18 I/O lines; it is particularly worth mentioning that its I/O ports can all have pull-ups, and the P0 port also has a special keyboard interrupt function. If these port lines are used as buttons, a corresponding interrupt will be generated when any key is pressed.

Hardware Design

Figure 2 Register address arrangement [page]

D7 D6 D5 D4 D3 D2 D1 D0
D3-D0, number of LED digits displayed
D4 Data format, 0-ASCII code, 1-BCD code
D6 Keyboard working mode, 0-simple key, 1-scan keyboard
D5, D7 Reserved

Figure 3 Control register format

This design uses 87LPC762 to form a minimum single-chip microcomputer system. In order to minimize the cost and the simplest structure, and considering that its reliability requirements are not too high, the oscillator, power-on reset and watchdog circuit inside the single-chip microcomputer are used, so that 18 I/O lines can be used. Considering the number of bits of the driven LED digital tube and the driving ability of the single-chip microcomputer port line, the serial interface of 87LPC762 is used to expand the shift register. In this application, since the total number of bits displayed is 8-bit LED, two shift registers 74HC595 are used, one of which is used as the position control of the display and the other is used as the segment control. According to the output driving characteristics of the 74HC series chip, the current limiting resistor can be used directly to drive the segments and bits of the digital tube with the output of 74HC595. The results show that under the conditions of a power supply voltage of 5V and a small number of digital tubes displayed, it has good brightness and can work stably for a long time. The key can be directly connected to the P0 port of 87LPC762, so that its circuit structure is the simplest. When working, the key interrupt mode of 87LPC762 can be used without adding any external components. However, when using 87LPC762 without scanning mode, there can be only 8 keys at most. Here, P0.0~P0.7 are used as input, and there can be 8 keys, which is enough in general; if the number of keys required is large, a scanning keyboard can be used. The data exchange between the display/keyboard part and the main CPU in the system uses the I2C interface, and 87LPC762 is used as a slave device; when working, the main CPU of the system only needs to send the data to be displayed to 87LPC762 in a standard format through the I2C interface. In addition, 87LPC762 uses an I/O line as a signal line to send an interrupt request to the main CPU of the system. When a key is pressed, 87LPC762 analyzes and identifies it and sends an interrupt request to the main CPU of the system. After the main CPU of the system responds to the interrupt, it reads the key value from 87LPC762 through the I2C interface. The hardware circuit of this design is shown in Figure 1.

Software Design

The software design mainly includes the design of display driver, keyboard recognition and analysis program and I2C interface program. The display program design is relatively simple. Let the serial interface of 87LPC762 work in mode 0, use a timer/counter to work in timing mode, determine the timing constant according to the number of displayed bits and scanning frequency, turn on the timing interrupt, and send the displayed segment control and bit control codes through the serial port after P87LPC762 enters the interrupt. The keyboard can use the key interrupt function of P87LPC762. When a key is pressed, it enters the interrupt service program to perform key anti-shake, recognition, etc., which will not be repeated here.

The following mainly introduces the interface design and considerations of the I2C interface and driver software. The 87LPC762 has a complete I2C interface component inside. It can work in master mode or slave mode. Here, it can work in slave mode, and its programming is relatively simple. In slave mode, the 87LPC762 needs a slave address. This address can be selected according to our needs, but be careful not to conflict with other I2C device addresses in the system. The software interface design is exactly the same as the standard I2C device. When accessing, the device address is written first, followed by the on-chip address; when accessing, it can be accessed to a specific unit or to several units continuously. In order to facilitate the main CPU in the system to access the keyboard and display circuit, the circuit provides a standard interface to the outside, that is, 10 registers that can be accessed by the main CPU through I2C. The address arrangement of these registers is shown in Figure 2. Note that this is only the address used when accessing through the I2C interface, not the real address in the internal RAM of the 87LPC762. When working, the main CPU only needs to write the data to be displayed through the I2C interface according to the address, and the 87LPC762 will display it. Similarly, when 87LPC762 recognizes that a key is pressed, it puts the key code of the key into the register, and then sends an interrupt request to the main CPU. The main CPU responds to the interrupt and reads the key code from the address specified in 87LPC762 through the I2C interface. It can be seen that we can use 87LPC762 as a dedicated keyboard and display chip. In order to make the circuit more convenient and flexible to use, a control register is also set to control the number and mode of display, the keyboard working mode, etc. as shown in Figure 3. On this basis, some other functions can be added, such as making the specified bit flash, turning off the display when no key is pressed for a long time, entering protection mode, etc. The control register is used to control the working mode of the display/keyboard circuit, and its format is shown in Figure 3.

The main CPU in the system can use a single-chip microcomputer with an I2C interface; it can also use a single-chip microcomputer without a dedicated I2C interface. In this case, the I2C interface can be simulated by software.

Conclusion

The display and keyboard circuit composed of P87LPC762 has the characteristics of simple structure, powerful function, simple interface with the system main CPU, convenient use and low cost, and has been successfully used in the intelligent instrument developed by us. In fact, we can integrate P87LPC762, 74HC595 and other chips together to make a dedicated display and keyboard module.

Reference
1 He Limin. I2C Application System Design. Beijing: University of Aeronautics and Astronautics Press

Keywords:MCU Reference address:Keyboard display circuit composed of 87LPC76x single chip

Previous article:The specific application of time-sharing operating system concept in single-chip microcomputer
Next article:Anti-interference measures in single chip microcomputer system application

Recommended ReadingLatest update time:2024-11-16 23:47

51 Single Chip Microcomputer (Twenty-Seven) - Buzzer plays music
1. Introduction to experimental principles Buzzers are commonly used sound-generating devices in circuits. We usually use buzzers to make "beep" sounds as prompts. Have you ever thought that you can also use buzzers to play music? This is obviously a very interesting thing. This article uses a buzzer to play music.
[Microcontroller]
51 Single Chip Microcomputer (Twenty-Seven) - Buzzer plays music
How to make a countdown timer using AT89C2051 microcontroller
The countdown timer is very useful in daily life. It is made by using a microcontroller. Not only the circuit is simple, but the functions can be designed according to the needs. There are many countdown timers designed by 74 series and 40 series small-scale digital chips, but they have shortcomings such as unintuitiv
[Microcontroller]
How to make a countdown timer using AT89C2051 microcontroller
Application of Timer/Counter of PIC16F87X MCU
The PIC16F87X microcontroller has three timer/counters configured inside, which are TMR0, TMR1, and TMR2. These three timer/counter modules are not only different in circuit structure, but also different in design intention and use. Timer/Counter TMR0. Timer/Counter TMR0 is the most commonly used device among the th
[Microcontroller]
Application of Timer/Counter of PIC16F87X MCU
PIC microcontroller infrared remote control coding and recognition
    Infrared remote control is widely used, and encoding and recognition are often the most headaches for microcontroller beginners. In fact, infrared encoding and recognition are not difficult. The key is to master the methods of infrared encoding and recognition. First, let us understand infrared encoding.     1.
[Microcontroller]
Detailed Analysis of Electromagnetic Compatibility Design of Single Chip Microcomputer System
 As MCU systems are increasingly used in consumer electronics, medical, industrial automation, intelligent instrumentation, aerospace and other fields, MCU systems are facing increasingly serious threats from electromagnetic interference (EMI). Electromagnetic compatibility (EMC) includes two aspects: emission and se
[Microcontroller]
Detailed Analysis of Electromagnetic Compatibility Design of Single Chip Microcomputer System
Circuit diagram of left and right movement of advertising light based on single chip microcomputer
To move a single light left and right, the hardware circuit is shown in the figure. The eight light-emitting diodes L1 - L8 are respectively connected to the P1.0 - P1.7 interfaces of the single-chip computer. When the output is "0", the light-emitting diode lights up. At the beginning, P1.0 → P1.1 → P1.2 → P1.3 →┅→ P
[Analog Electronics]
Circuit diagram of left and right movement of advertising light based on single chip microcomputer
PIC microcontroller software simulation IIC read and write routines
;I2C bus program  ;this is eeprom read & write programm  ;the special store ram unit  w equ 0  f0 equ 0  rt CC     equ 1  pc    equ 2  f2    equ 2  f3    equ 3  f4    equ 4  ra    equ 5  rb    equ 6  rc    equ 7  pclath    equ 0ah  i NTC on    equ 0bh  pir1    equ 0ch  tmr1l    equ 0eh  tmr1h    equ 0fh  t1con    equ 
[Microcontroller]
Teach you how to DIY music spectrum display using 51 single chip microcomputer
Whenever I see the rows of small lights on the speakers and amplifiers at home jumping like waves with the music being played, or when I open the music player software Qianqian Jingting on my computer and see the dynamic spectrum dancing gracefully with the rhythm of the music, I can't help but think about it. If I ca
[Power Management]
Teach you how to DIY music spectrum display using 51 single chip microcomputer
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号