Method of Expanding High-Speed ​​Serial Synchronous Shift Output Port of AT89C51 Single-Chip Microcomputer

Publisher:MengyunLatest update time:2017-12-26 Source: eefocusKeywords:AT89C51 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

The serial port of the AT89C51 (compatible with MCS-51) microcontroller can expand multiple 8-bit parallel I/O ports using a shift register chip in mode 0. In the LED dot matrix display application system, the data synchronous shift output method is generally adopted, and the shift register chip (such as 74LS595) is used to expand the parallel I/O port to drive the LED dot matrix display. The LED dot matrix display adopts a scanning method. In order to avoid flickering, 50 screens of dot matrix display data need to be transmitted per second. Therefore, a large amount of data needs to be sent to the display drive circuit part through synchronous shifting, which requires the microcontroller to output data quickly. The serial port of the AT89C51 microcontroller is in mode 0. The data is output at a baud rate of fosc/12. After 1 byte of data is written to SBUF, it is necessary to check whether the interrupt flag TI is "1" and clear "0" TI or delay several machine cycles before continuing to write a data. The output speed is slow. In the LED dot matrix display application system, the communication between the system and the PC needs to use the serial port of the microcontroller, and the synchronous shift output port of the display data can only be expanded separately. The high-speed serial synchronous shift output port (hereinafter referred to as the extended serial port) circuit introduced in this article adopts modular design and provides implementation solutions based on TTL and PLD circuits. The baud rate is increased to fosc, and data output does not require waiting or delay.


1. Extend the connection between the serial port and the microcontroller

The block diagram of the extended serial port circuit is shown in Figure 1. Similar to the parallel memory chip, the extended serial port is regarded as an external RAM address unit, directly connected to the external data bus of AT89C51, D0~D7 are data lines, CE is the chip select signal, WE is the write pulse signal, and also the output control signal of the extended serial port. The oscillation signal of the AT89C51 external crystal oscillator is shaped by two NAND gates to provide the clock pulse XTAL2 for the extended serial port. DAT and CLK are the data output terminal and synchronous shift pulse output terminal of the extended serial port respectively.

29.gif

2. Operation Instructions

Assume that the address assigned to the extended serial port by AT89C51 is 0000H, use MOVX@DPTR, A or MOVX@R0, A instruction to write data into the extended serial port and shift the data. The following program segment sends 32 bytes of data with the first address of the internal RAM data area being 30H to the extended serial port for synchronous shift output:
MOV P2, #00H; Set the high 8 bits of the extended serial port address
MOV R1, #30H; Set the first address of the internal RAM data area
MOV R7, #32; Output the number of bytes
LOOP: MOV A, @R1; Read 1 byte from the internal RAM data area
INC R1; Point to the next address unit of the internal RAM data area
MOVX @R0, A; Send data to the extended serial port for output
DJNZ R7, LOOP; 32 bytes have not been sent and continue
RET

3. Design scheme and working principle based on TTL circuit

30.gif

Figure 2 is an extended serial port circuit implemented with TTL circuit. 74LS74 is a dual rising edge D flip-flop with preset and clear functions. D1~D5 constitute an 8-pulse generator (counter principle). 74LS165 is an 8-bit parallel input serial output shift register. When the CPU executes the MOVX@R0, A (or MOVX @DPTR, A) instruction, the data is latched in the 74LS165. The timing of generating 8 pulse signals is shown in Figure 3. In Figure 3, Q0~Q5 are the output ends of 6 D flip-flops respectively. The extended serial port chip select is valid (CE=0). When the write pulse WE arrives, WR=0. At the rising edge of the clock pulse XTAL2, the output Q0 of the flip-flop D0 is 0, and Q0 resets Q5, making Q5=1; after the write pulse ends, WR=1, then WR·Q5=1, the reset end of the counter is invalid, the counter starts counting, and outputs a square wave pulse at the Q1 end; after the 8th pulse ends, Q5=1, then WR·Q5=0, the counter is reset, stops counting, and waits for the next write pulse. The 8 pulses output from the Q1 terminal are connected to the CLK2 (pin 15) of the 74LS165 as synchronous shift pulses, and are also the synchronous shift pulse output signals of the extended serial output port: the data latched in the 74LS165 by the MOVX instruction is output from the data terminal (DAT) of the extended serial output port under the action of the synchronous shift pulse (CLK).

31.gif

32.gif


4. Design scheme based on PLD circuit

Using programmable gate array devices to design circuits can simplify circuits and reduce the number of devices. The 8-pulse generator circuit in the dotted box in Figure 2 can be realized with one GAL16V8D, as shown in Figure 4. XTAL2 is the extended serial port clock pulse input signal, WR is the write pulse signal when the chip select is valid, and Q1 is the 8-pulse output terminal. Write the logical expression of Q1~Q5 according to the timing diagram shown in Figure 3. The following is an example of the logic design of the GAL16V8D chip.

AFT16V8D
NAME: ED13_U00
AUTHOR: FUHAO
DATE: 04.15.1999
; 1 2 3 4 5 6 7 8 9 10 (pin)
CLK WR NC NC NC NC NC NC NC GND
; 11 12 13 14 15 16 17 18 19 20 (pin)
OE Q1 Q2 Q3 Q4 Q5 NC NC NC VCC
Q1:=/Q1*WR*/Q5
Q2:=/Q2*Q1*WR*/Q5
+Q2*/Q1*WR*/Q5
Q3:=/Q3*Q2* Q1*WR*/Q5
+Q3*/Q2*WR*/Q5
+Q3*/Q2*WR*/Q5
Q4:=/Q4*Q3*Q2*Q1*WR*/Q5
+Q4*/Q3*WR*/Q5
+Q4*/Q2*WR*/Q5
+Q4*/Q1*WR*/Q5
Q5:=/ Q5*Q4*Q3*Q2*Q1*WR
+Q5*/Q4*WR + Q5
*/Q3*WR
+Q5*/Q2*WR
+Q5*/Q1*WR
DESCRIPTION
 

The method of expanding the high-speed serial synchronous shift output port of the microcontroller introduced in this article, as well as the implementation scheme based on TTL and PLD circuits, have been successfully applied in the LED dot matrix display system. The expansion serial port adopts modular design and is easy to transplant to other application systems.


Keywords:AT89C51 Reference address:Method of Expanding High-Speed ​​Serial Synchronous Shift Output Port of AT89C51 Single-Chip Microcomputer

Previous article:Selection of Precise Timing Programming Methods for Timing Interrupts of MCS-51 Single Chip Microcomputer
Next article:Using 51 Single Chip Microcomputer to Control PS/2 Keyboard

Recommended ReadingLatest update time:2024-11-16 13:05

Interface Program between PCF8591 and AT89C51 MCU
  AT89C51 is used as the main device. Four PCF8591 chips are connected to the I2C bus. The chip addresses are (OOOb, OlOb, 020b, 400b) respectively. P3.6 of 89C51 is used as the SCL signal. P3.7 is used as the SDA signal. The analog input of each chip is input in single-ended mode. The reference voltage VREF is 4.8V.
[Microcontroller]
Interface Program between PCF8591 and AT89C51 MCU
Application of AT89C51 single chip microcomputer in cutting force measurement of CNC lathe
1 Problem statement   In the processing of CNC lathes, the measurement of cutting force is very important. By measuring the cutting force, we can analyze and study the stress conditions and working conditions of various parts, mechanisms or structures of CNC lathes, verify the correctness of the design and calculation
[Microcontroller]
Application of AT89C51 single chip microcomputer in cutting force measurement of CNC lathe
DIY your own AT89C51 programmer
AT89C51 is the most widely used 8051 microcontroller . More importantly, it has the feature of repeated programming (FLASH). Generally, it can be repeatedly programmed 1,000 times, which provides a cheap platform for beginners to experiment. In order to meet the needs of the majority of microcontroller enthusiasts, I
[Microcontroller]
DIY your own AT89C51 programmer
The single chip microcomputer (AT89C51) button controls the LED light to realize the running light and flashing running light
Preface  It's been a long time since I wrote about the microcontroller series. Without further ado, let's get straight to the point! The experiment I'm going to explain and share this time is a famous running light experiment, but this experiment is to achieve "running water" by clicking a button yourself, which is di
[Microcontroller]
The single chip microcomputer (AT89C51) button controls the LED light to realize the running light and flashing running light
Brief Introduction of Intelligent Softening Point Tester of Asphalt Using Single Chip Microcomputer
introduction The asphalt ball sample with a diameter of 10mm is placed on a bracket immersed in a heat transfer medium. When heated to a certain temperature, the asphalt melts. At this time, asphalt solution will drip from the sample through the holes on the bracket and be detected by the photoelectric detectio
[Microcontroller]
Brief Introduction of Intelligent Softening Point Tester of Asphalt Using Single Chip Microcomputer
at89c51 chip pin diagram pin diagram
at89c51 chip pin diagram pin diagram AT89C51 internal function diagram:
[Microcontroller]
at89c51 chip pin diagram pin diagram
AT89C51 single chip microcomputer --4.LED flashing
1. Loop Statement (1) while (2) for 2. Definition of variables Data type variable name Global variables: variables defined outside a function, scope: the entire program from the time of definition Local variables: variables defined within a function, scope: within the function body 3. Software delay (1) Soft
[Microcontroller]
AT89C51 single chip microcomputer --4.LED flashing
Application of alarm system in chip
Traditional wired burglar alarms only sound an alarm locally when a theft is detected. They have no internal controller and are easily damaged and ineffective. They are also inconvenient to install and expand. The wireless burglar alarm designed in this paper is controlled by a single-chip microcomputer. It has powerfu
[Microcontroller]
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号