当前位置:网站首页>[MCU] 2.2 pin function of AT89S52
[MCU] 2.2 pin function of AT89S52
2022-07-27 17:39:00 【tsunaa】
2.2 AT89S52 Pin function of
- AT89S52 With all kinds of 8051 The pins of MCU are compatible . at present ,AT89S52 Single chip microcomputer mostly adopts 40 Pin DIP encapsulation ( Double in line ), as well as 44 Pin PLCC and TQFP Chip with packaging method .



- 44 Pin PLCC and TQFP Chip with packaging method , Yes 4 Only pins are useless , Marked as “NC”.
The pins can be divided into the following according to their functions 3 class :
- (1) Power supply and clock pin —VCC、VSS;XTAL1、XTAL2.
- (2) Control pin — PSEN*、ALE/PROG*、EA* /VPP、RST
- (3)I/O Port pin ——P0、P1、P2、P3, by 4 individual 8 position I/O mouth
The following describes the functions of each pin .
2.2.1 Power supply and clock pin
- Power pin
- VCC(40 foot ):+5V Power Supply .
- VSS(20 foot ): Digitally .
- Clock pin
- XTAL1(19 foot ): On chip oscillator inverting amplifier and clock generator circuit input . use On chip oscillator when , This pin is connected to the outside Quartz crystal and fine tuning capacitor . External clock source , This pin is connected External clock oscillator The signal of .
- XTAL2(18 foot ): The output of the on-chip oscillator inverting amplifier . When using On chip oscillator , This pin is connected to the outside Quartz crystal and fine tuning capacitor . When using External clock source when , Benjiao In the air .
2.2.2 Control pin
(1)RST (RESET,9 foot )
- Reset signal input , Add The duration is greater than 2 High level of a machine cycle , It can reset the single chip microcomputer . Normal work , This pin level should ≤ 0.5V.
- When the watchdog timer overflows the output , This pin will output up to 96 High level of clock oscillation cycle .
(2) EA* / VPP (Enable Address/Voltage Pulse of Programing,31 foot )
- EA*: Pin The first function : External program memory access allows the control side to .
- EA* = 1, stay PC The value does not exceed 1FFFH( That is, not beyond the film 8KB Flash Address range of memory ) when , Single chip microcomputer reading On chip program memory (8KB) Program in , but PC It's worth more than 1FFFH ( That is, beyond the film 8KB Flash Address range ) when , take Automatic steering reading sheet out (2000H-FFFFH) A program in a program memory space .
- EA* = 0, Read only external program memory The content in , The address range read is 0000H~FFFFH, Intraslice 4KB Flash Program memory does not work .
- VPP: Pin Second function , On film Flash Programming , Pick up Programming voltage .
(3)ALE / PROG*(Address Latch Enable/PROGramming,30 foot )
- ALE by Address latch control signal end , by The first function . Due to the limited number of pins ,P0 The mouth is as low 8 Bit address bus and 8 Bit data bus Time division multiplexing Of . When MCU accesses external program memory or external data memory ,ALE The negative jump of will be single-chip P0 Mouth first low 8 Bit address lock exists P0 In the address latch connected outside the port , then P0 Mouth again as 8 Bit data bus use , Pictured 2-4 Shown .

- Besides , Single chip microcomputer The normal operation when ,ALE End There is always a positive pulse signal output , This frequency is the clock frequency fosc Of 1/6. It can be used as external timing or trigger signal .
- Be careful , whenever AT89S52 External access RAM when ( perform MOVX Class instructions ), want Lose one ALE pulse .
If not required ALE End output pulse signal , Can be special function register AUXR( The address is 8EH, Will be introduced later ) Of The first 0 position (ALE Forbidden bit ) Set up 1, To prohibit ALE operation , But execute instructions to access external program memory or external data memory “MOVC” or “MOVX” when ,ALE Still valid . namely ALE The forbidden bit does not affect access to external memory .
- PROG*: Pin Second function , On film Flash Programming , by Program the pulse input pin .
(4) PSEN* (Program Strobe ENable,29 foot )
- Off chip program memory read strobe signal , Low level active .
2.2.3 parallel I/O Port pin
(1)P0 mouth :P0.7~P0.0 Pin
- Open drain 8 Bit parallel two-way I/O mouth . As an output port , Each pin can drive 8 individual LS type TTL load . When AT89S52 Expand external memory and I/O Interface chip ,**P0 The port is low for time-sharing multiplexing 8 Bit address / data bus .** In the P0 Write in “1” Then it becomes the input port of high resistance state .
- When P0 To act as Universal I/O mouth When using , A pull-up resistor is required , This is Quasi two-way port .
- In the face of Flash When programming program memory ,P0 Port receives byte code , Program verification P0 Port output byte code , During the program verification, the pull-up resistor should be connected externally .
(2)P1 mouth :P1.7~P1.0 Pin
Quasi bidirectional I/O mouth , have Internal pull-up resistor , Can drive 4 individual LS type TTL load .
In the opposite film Flash It is defined as low 8 Bit address line .
P1 The second function of some pins of the port is as follows .
- P1.0/T2:T2 Feet are timers T2 External counting signal input of T2.
- P1.1/T2EX:T2EX by T2 The capture of / Reload trigger and direction control T2EX.
- P1.5/MOSI:MOSI Used for on-chip Flash Memory serial programming and verification .
- P1.6/MISO:MISO Used for on-chip Flash Memory serial programming and verification .
- P1.7/SCK:SCK Used for on-chip Flash Shift pulse input pin for serial programming and verification of memory .
Be careful :AT89S51 And AT89S52 The difference in pins is only 1 foot (P1.0) And 2 foot (P1.1) On ,AT89S52 Of 1 foot (P1.0) And 2 foot (P1.1) , respectively, Added timer / Counter T2 Two external pins of T2 and T2EX The reuse function of . When AT89S52 SCM does not use on-chip T2 The two pins of T2(P1.0) and T2EX(P1.1) The reuse function of ,AT89S51 As well as a variety of 8051 Compatible with AT89S52 The pin function of is exactly the same , Their peripheral hardware interface circuits are completely universal .
But if you use a timer T2 External count input of T2(P1.0) and “ capture ” Input T2EX (P1.1) The function of the , be AT89S52 Of P1.0 Feet and P1.1 Feet can't be used for general purpose I/O Use , This is a AT89S52 And AT89S51( or AT89C51) Minor differences in peripheral interface circuit design .
(3)P2 mouth :P2.7~P2.0 Pin
- Quasi bidirectional I/O mouth , Pin There is a pull-up resistor inside , Can drive 4 individual LS type TTL load .
- When AT89S52 Access external memory and I/O When you talk ,P2 mouth As high 8 Bit address bus use , High output 8 Bit address .
- When P2 Mouth not as high 8 Bit address bus , Can be used as General purpose I/O mouth Use .
(4)P3 mouth :P3.7~P3.0
- Quasi bidirectional I/O mouth , have Internal pull-up resistor .
- P3 Oral The first function As a General purpose I/O mouth Use , Can drive 4 individual LS type TTL load .
- P3 Mouth can also provide Second function . The second function is defined in table 2-1, Remember .

- in summary ,P0 mouth It can be used as a bus port , It is a two-way port . As a universal I/O When using mouth , Subject to two-way opening , At this time, the pull resistance should be added .P1 mouth 、P2 mouth 、P3 mouth Both are quasi two-way ports .
- Be careful : The difference between quasi two-way port and two-way port . The quasi two-way port has only two states . and P0 The port is used as a bus , There is no pull-up resistance in the port line , At high resistance “ suspension ” state . so P0 The mouth is bidirectional Tristate I/O mouth .
- Why? P0 The mouth should have high resistance “ suspension ” state ? Quasi bidirectional I/O The mouth has no high resistance “ suspension ” state .
- in addition , Quasi two-way port For general use I/O When using the input port of , Be sure to write to this port first “1” . The difference between the above quasi two-way port and two-way port , The reader is reading 2.5 Postganglionic , Will have a deep understanding .
- thus ,40 Pins have been introduced , Remember that the function of each pin is very important for the hardware circuit design of the application system .
边栏推荐
- 立创EDA——PCB的布局(四)
- Day07 operation
- 【obs】NewSocketLoopEnable 网络优化
- MySQL: Functions
- 步 IE 后尘,Firefox 的衰落成必然?
- Big manufacturers finally can't stand "adding one second", and companies such as Microsoft, Google meta propose to abolish leap seconds
- 【数据库系统概论(王珊)】第4章——数据库安全性
- 科目三: 直线行驶
- 微软默默给 curl 捐赠一万美元,半年后才通知
- Global string object (function type) +math object
猜你喜欢

信号量保护之位带操作

阿里巴巴鹰眼系统简介

The 7-year-old boy broke his finger by AI robot just because he played chess too fast?

With the arrival of large displacement hard core products, can the tank brand break through the ceiling of its own brand?

Day 7 summary & homework

Kubernetes第七篇:使用kubernetes部署prometheus+grafana监控系统(Kubernetes工作实践类)

Gree "not cool": the giant lawsuit ended and was reduced by large dealers. Is it too late for the new battlefield of air conditioning?

Kubernetes Part 7: using kubernetes to deploy prometheus+grafana monitoring system (kubernetes work practice class)

SAP UI5 FileUploader 的隐藏 iframe 设计明细

Three table joint query 3
随机推荐
Motion capture system for end positioning control of flexible manipulator
技术实践干货 | 从工作流到工作流
Dense optical flow extraction dense_ Flow understanding
KMP模板——字符串匹配
Kubernetes Part 7: using kubernetes to deploy prometheus+grafana monitoring system (kubernetes work practice class)
Database hyperphone (4)
Kubernetes第八篇:使用kubernetes部署NFS系统完成数据库持久化(Kubernetes工作实践类)
信通院陈屹力:降本增效是云原生应用最大价值
【单片机】2.2 AT89S52的引脚功能
风口之下,隐形正畸还能走多远?
如何通过C#/VB.NET从PDF中提取表格
详解二叉树之堆
选择体育场馆的LED显示屏时应该注重哪些方面
一文理解分布式开发中的服务治理
大厂们终于无法忍受“加一秒”了,微软谷歌Meta等公司提议废除闰秒
Bit band operation of semaphore protection
Hyperlink parsing in MD: parsing `this$ Set() `, ` $` should be preceded by a space or escape character`\`
三表联查1
Shell编程规范与变量
Maximum number less than n