MCU input/output (I/O) port

Publisher:心若清泉Latest update time:2011-09-23 Keywords:MCU Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

The MCS-51 microcontroller has four bidirectional 8-bit I/O ports, P0~P3 are three-state bidirectional ports, P1, P2, and P3 are quasi-bidirectional ports (when used as input, the port line is pulled to a high level, so it is called a quasi-bidirectional port).

Port P0 is a three-state bidirectional port, commonly known as the data bus port, because it is the only port that can be directly used for read/write operations on external memory. Port P0 can also be used to output the 8th address of the external memory. Since it is a time-sharing output, a latch should be added externally to latch this address data, and the address latch signal is ALE.

Port P1 is an I/O port for users. Users can use it as an I/O port line. Port P1 is a quasi-bidirectional port. Each bit is composed of a latch (SFR), an output driver, and an input buffer. Their pull-up resistors are actually not linear resistors, but are composed of field effect transistors, and each latch is composed of a D flip-flop.

Each I/O port has two reading methods: read latch and read pin. Each reading method has a corresponding instruction. The read pin instruction is generally an instruction with the I/O port as the original operand. When executing the read pin instruction, the three-state gate input port state must be turned on. For example: when reading the input state of port P1. The read pin instruction is: MOV A.P1

According to the structure of the I/O port and the control method of the CPU, after executing the read pin operation, the port latch state and the pin state should be the same. However, after writing a certain state to the port latch, whether the corresponding port pin presents a latch state depends on the connection of the external circuit. For example: when the base of a transistor is driven by an I/O port line, the transistor will be turned on after the bit latch of the port line is written with 1, and once the transistor is turned on, the base level is "0". If there is no read pin operation on the port line, the port latch and the pin state are inconsistent.

Keywords:MCU Reference address:MCU input/output (I/O) port

Previous article:Design of thyristor trigger circuit based on 8031 ​​single chip microcomputer
Next article:MCU hardware knowledge

Recommended ReadingLatest update time:2024-11-16 22:35

Getting Started with PIC Microcontrollers
The first step is to download a development environment. There are two types of PIC development environments: MPLAB IDE and MPLAB X IDE. X requires JAVA to be installed, so it is recommended to install the old version first. The following is the link: http://www.microchip.com/stellen ... 9&part=SW007002. After open
[Microcontroller]
Getting Started with PIC Microcontrollers
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 micr
[Industrial Control]
Low frequency digital phase measuring instrument based on AVR microcontroller and FPGA
MCU bare metal development experience
I have seen many friends in the forum who have a habit when learning bare metal - when doing bare metal development, they over-rely on Tianqian's bare metal test program. How should I put it? I think this is not a good idea, especially for a novice. Maybe it’s because I studied microcontrollers, I have a bad habit of
[Microcontroller]
MCU waveform generator source code
Program source code #include reg51.h #include intrins.h #include math.h #define  uchar  unsigned  char #define  uint  unsigned   int unsigned long Result,i; sbit SDA=P1^1; //PCF8591  interface sbit SCL=P1^0; unsigned int a=0; // waveform sampling point value unsigned int b=0; unsigned  int c=0; unsigned  int bx_
[Microcontroller]
MCU waveform generator source code
Analysis of the conditions and causes of internal reset in PIC16F87X series microcontrollers
The reset function of the PIC16F87X series microcontrollers is relatively well designed. The conditions and reasons that cause the internal reset of the microcontroller can be roughly summarized into the following five types. 1. Power-on reset Every time the microcontroller is powered on, the power-on reset circuit
[Microcontroller]
Analysis of the conditions and causes of internal reset in PIC16F87X series microcontrollers
Design of portable ultrasonic underwater sound pressure meter based on single chip microcomputer
  With the development of underwater ultrasonic technology, the need to test its sound intensity has been raised in many application areas. We use CS-3 hydrophone to design a portable ultrasonic sound pressure meter.   System Design   Design goal requirements: To achieve the measurement of 15-45kHz ultrasonic soun
[Microcontroller]
Microcontroller introductory experiment seven
;************************************************; ;Experiment name: 1 independent keyboard controls LED light experiment            ; ;Author:                          Long Yi                                ; ;Version:                        VER 1.0                            ; ;Description:              Beginner'
[Microcontroller]
Idle mode and sleep mode of STC12 series microcontrollers
1. Idle mode Idle mode refers to the state where only the microcontroller is not working. At this time, the CPU has no clock and stops working, but the external interrupt, external low voltage detection circuit, timer, A/D conversion, serial port, etc. are still running normally. In idle mode, the RAM, stack point
[Microcontroller]
Idle mode and sleep mode of STC12 series microcontrollers
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号