at89c52中文资料介绍
at89c52单片机简介中英文对照外文翻译文献
at89c52单片机简介中英文对照外文翻译文献中英文资料对照外文翻译A T89C52 Single-chip microprocessor introductionSelection of Single-chip microprocessor1. Development of Single-chip microprocessorThe main component part of Single-chip microprocessor as a result of by such centralize to be living to obtain on the chip,In immediate future middle processor CPU。
Storage RAM immediately﹑memoy read ROM﹑Interrupt system、Timer /'s counter along with I/O's rim electric circuit awaits the main microcomputer section,The lumping is living on the chip。
Although the Single-chip microprocessor r is only a chip,Yet through makes up and the meritorous service be able to on sees,It had haveed the calculating machine system property,calling it for this reason act as Single-chip microprocessor r minisize calculating machine SCMS and abbreviate the Single-chip microprocessor。
51单片机AT89C52中文资料
51单片机AT89C52中文资料--------------------------------------------------------------------------------51单片机AT89C52中文资料AT89C52 ATMEL公司生产的低电压,高性能CMOS 8位单片机.片内含8K byTES的可反复擦写的只读程序存储器(PEROM)和256 byTES 。
的随机存取数据存储器(RAM),器件采用ATMEL公司的高密度、非易失性存储技术生产,与标准MCS-51指令系统及8052 产品引脚兼容,片内置通用8位中央处理器(CPU )和FLASH由存储单元,功能强大AT89C52单片适用于许多较为复杂控制应用场合。
主要性能参数:与Mcs-51产品指令和引脚完全兼容。
8字节可重擦写FLASH闪速存储器1000 次擦写周期全静态操作:0HZ-24MHZ三级加密程序存储器256X8字节内部RAM32个可编程I/0口线3个16 位定时/计数器8个中断源可编程串行UART通道低功耗空闲和掉电模式内部结构图AT89C52内部框图功能特性:AT89C52 提供以下标准功能:8字节FLASH闪速存储器,256字竹内部RAM , 32个I/O口线,3个16 位定时/计数器,一个6向量两级中断结构,一个全双工串行通信口,片内振荡器及时钟电路。
同时,AT89c52可降至OHz的静态逻辑操作,并支持两种软件可选的节电上作模式。
空闲方式停止CPU 的工作,但允许RAM,定时/计数器.串行通信口及中断系统继续工作。
掉电方式保存RAM 中的内容,但振荡器停止工作并禁止其它所有部件工作直到下一个硬件复位.功能引脚说明:Vcc:电源电压GND:地P0:P0口是一组8位漏极开路型双向1/O 口,也即地址/数据总线复用口。
作为输出口用时.每位能吸收电流的方式驱动8个TTL 逻辑门电路,对端口P0 写“1”时,可作为高阻抗输入端用。
AT89C52中文资料
AT89C52中文资料AT89C52的中文资料AT89C52是美国Atmel公司生产的低电压、高性能CMOS 8位单片机,片内含8KB的可反复檫写的程序存储器和12B的随机存取数据存储器(RAM),器件采用Atmel公司的高密度、非易失性存储技术生产,兼容标准MCS-51指令系统,片内配置通用8位中央处理器(CPU)和Flash存储单元,功能强大的AT89C52单片机可灵活应用于各种控制领域。
AT89C52单片机属于AT89C51单片机的增强型,与Intel 公司的80C52在引脚排列、硬件组成、工作特点和指令系统等方面兼容。
其主要工作特性是:片内程序存储器内含8KB的Flash程序存储器,可擦写寿命为1000次;片内数据存储器内含256字节的RAM;具有32根可编程I/O口线;具有3个可编程定时器;中断系统是具有8个中断源、6个中断矢量、2个级优先权的中断结构;串行口是具有一个全双工的可编程串行通信口;具有一个数据指针DPTR;低功耗工作模式有空闲模式和掉电模式;具有可编程的3级程序锁定位;AT89C52工作电源电压为5(1+0.2)V,且典型值为5V;AT89C52最高工作频率为24MHz。
单片机正常工作时,都需要有一个时钟电路和一个复位电路。
本设计中选择了内部时钟方式和按键电平复位电路,来构成单片机的最小电路。
如图3.1所示。
功能特性描述AT89S52是一种低功耗、高性能CMOS8位微控制器,具有8K 在系统可编程Flash 存储器。
使用Atmel 公司高密度非易失性存储器技术制造,与工业80C51 产品指令和引脚完全兼容。
片上Flash允许程序存储器在系统可编程,亦适于常规编程器。
在单芯片上,拥有灵巧的8 位CPU 和在系统可编程Flash,使得AT89S52为众多嵌入式控制应用系统提供高灵活、超有效的解决方案。
AT89S52具有以下标准功能:8k字节Flash,256字节RAM,32 位I/O 口线,看门狗定时器,2 个数据指针,三个16 位定时器/计数器,一个6向量2级中断结构,全双工串行口,片内晶振及时钟电路。
at89c52
AT89C52概述AT89C52是一款高性能的8位单片机,由Atmel公司生产。
它是AT89系列单片机中的一员,采用MCS-51指令集架构,并使用快速闪存储存程序。
AT89C52具有丰富的外设,包括多个输入输出引脚、计时器、串口通信接口等,广泛应用于嵌入式系统、通信设备、工业控制等领域。
主要特性•采用CMOS技术,工作电压范围广泛(2.4V至5.5V)•具有8KB的内部闪存,用于存储程序和数据•提供256字节的内部RAM,可用于数据存储•包含三个计时器/计数器,可用于定时/计数功能•集成两个串口通信接口,方便与外部设备进行数据交互•支持多种中断方式,提供更好的系统响应能力•可编程输入/输出引脚,可用于连接外部设备引脚描述AT89C52具有40个引脚,以下是一些重要引脚的描述:1.P1.0至P1.7: 8位并行输入/输出引脚,可根据需要进行配置。
在配置为输入时,可以连接外部设备并读取输入值;在配置为输出时,可以向外部设备发送数据。
2.P2.0至P2.7: 8位并行输入/输出引脚,也可以根据需要进行配置。
3.P3.0至P3.7: 8位并行输入/输出引脚,同时具有更多功能,包括与外部存储器的数据和地址传输,以及与LCD显示器的连接等。
4.RST: 复位引脚,将其拉低时可以重启单片机。
5.EA/VPP: 外部访问使能/编程电压引脚,可用于提供外部程序存储器的访问或编程电压。
6.XTAL1/XTAL2: 外部晶振引脚,接入适当的晶振电路以提供时钟信号。
闪存编程AT89C52的程序存储在内部闪存中。
要编程AT89C52,可以使用专用的编程器,通过并行端口或串行端口将目标程序下载到芯片中。
编程AT89C52的一般步骤如下:1.选择所需的编程器,并连接到AT89C52的编程接口。
2.打开编程器软件,并选择正确的单片机型号。
3.导入目标程序文件,该文件应该是以二进制格式存储的。
4.配置编程器选项,包括芯片复位方式、编程电压等。
at89c52单片机引脚说明
at89c52单片机引脚说明
,AT89C52高性能8位单片机
at89c52单片机引脚说明,AT89C52高性能8位单片机
AT89C52引脚图
AT89C52是一个低电压,高性能CMOS 8位单片机,片内含8k bytes的可反复擦写的Flash只读程序存储器和256 bytes的随机存取数据存储器(RAM),器件采用ATMEL公司的高密度、非易失性存储技术生产,兼容标准MCS-51指令系统,片内置通用8位中央处理器和Flash存储单元,功能强大的AT89C52单片机可为您提供许多较复杂系统控制应用场合。
AT89C52有40个引脚,32个外部双向输入/输出(I/O)端口,同时内含2个外中断口,3个16位可编程定时计数器,2个全双工串行通信口,2个读写口线,AT89C52可以按照常规方法进行编程,也可以在线编程。
其将通用的微处理器和Flash存储器结合在一起,特别是可反复擦写的Flash存储器可有效地降低开发成本。
AT89C52有PDIP、PQFP/TQFP及PLCC等三种封装形式,以适应不同产品的需求。
主要功能特性:
·兼容MCS51指令系统·8k可反复擦写(>1000次)Flash ROM
·32个双向I/O口·256x8bit内部RAM
·3个16位可编程定时/计数器中断·时钟频率0-24MHz
·2个串行中断·可编程UART串行通道
·2个外部中断源·共6个中断源
·2个读写中断口线·3级加密位
·低功耗空闲和掉电模式·软件设置睡眠和唤醒功能
1/ 1。
AT89C52单片机介绍
AT89C52单片机介绍在众多的单片机系列中,AT89C52是一种低功耗、高性能CMOS8位微控制器,具有8K在系列可编程Flash存储器。
使用Atmel公司高密度非易失性存储器技术制造,与工业80C51产品指令和引脚完全兼容。
片上Flash允许程序存储器在系统可编程,也适用于常规编程。
在单芯片上,拥有灵巧的8位CPU和在系统可编程Flash,使得AT89C52为众多嵌入式控制应用系统提供高灵活、超高效的解决方案。
AT89C52具有以下标准功能:8K字节Flash,256字节RAM,32位I/O口线,3个16位定时器/计数器,一个响亮2级中断结构,全双工串行口,片内晶振及时钟电路。
另外,AT89C52可降至0HZ静态逻辑操作,支持2种软件可选择节电模式。
空闲模式下,CPU停止工作,允许RAM、定时器/计数器、串口、中断继续工作。
掉电保护方式下,RAM内容被保存,振荡器被冻结,单片机一切工作停止,直到下一个中断或硬件复位为止。
AT89C52单片机为很多嵌入式控制系统提供了一种灵活性高且廉价的方案。
故此选用AT89C52单片机。
1 AT89C52单片机1.1 AT89C52单片机的硬件结构如图3-1所示,为AT89C52的硬件结构图。
AT89C52单片机的内部结构与MCS-51系列单片机的构成基本相同。
CPU是由运算器和控制器所构成的。
运算器主要用来对操作数进行算术、逻辑运算和位操作的。
控制器是单片机的指挥控制部件,主要任务的识别指令,并根据指令的性质控制单片机各功能部件,从而保证单片机各部分能自动而协调地工作。
它的程序存储器为8K字节可重擦写Flash闪速存储器,闪烁存储器允许在线+5V电擦除、电写入或使用编程器对其重复编程。
数据存储器比51系列的单片机相比大了许多为256字节RAM。
AT89C52单片机的指令系统和引脚功能与MCS-51的完全兼容。
图 3-1 单片机89C52结构框图1.2 主要性能参数• 8K字节可重擦写Flash闪速存储器• 1000次可擦写周期•全静态操作:0Hz-24MHz•三级加密程序存储器• 256×8字节内部RAM• 32个可编程I/O口线• 3个16位定时/计数器• 8个中断源•可编程串行UART通道•低功耗空闲和掉电模式图 3-2 AT89C52外部引脚图1.3 AT89C52管脚说明VCC:电源GND:接地P0口:P0口是一个8位漏级开路的双向I/O口。
外文翻译--AT89C52单片机的介绍
外文翻译--AT89C52单片机的介绍外文翻译AT89C52 单片机的介绍AT89C52 单片机是一款广泛应用于各种电子设备中的微控制器。
它具有高性能、低功耗、易于编程等优点,为许多电子项目的实现提供了强大的支持。
AT89C52 单片机拥有丰富的内部资源。
它包含 8KB 的可重复编程的 Flash 存储器,用于存储程序代码。
这使得开发者可以方便地修改和更新程序,而无需更换硬件。
此外,它还有 256 字节的内部 RAM,用于数据的临时存储和处理。
在处理能力方面,AT89C52 单片机采用了 8 位的中央处理器(CPU),工作频率可达 24MHz。
虽然相比于现代的高性能处理器,它的处理速度不算快,但对于许多简单的控制任务和实时性要求不高的应用来说,已经足够胜任。
例如,在一些小型的家电控制、简单的测量仪器以及玩具等产品中,AT89C52 单片机能够准确、稳定地执行控制逻辑。
该单片机的引脚功能也十分丰富。
它通常具有 40 个引脚,包括电源引脚、时钟引脚、复位引脚以及多个输入输出引脚。
电源引脚用于提供单片机正常工作所需的电压,一般为 5V。
时钟引脚则连接外部晶振,为单片机提供工作时钟。
复位引脚用于系统的初始化和异常情况下的恢复。
而众多的输入输出引脚可以配置为不同的工作模式,如输入模式用于接收外部信号,输出模式用于控制外部设备。
在编程方面,AT89C52 单片机支持多种编程语言,如汇编语言和 C 语言。
汇编语言虽然编写较为复杂,但执行效率高;C 语言则更易于理解和编写,适合较大规模的程序开发。
通过专门的编程工具,如Keil C51 等,可以将编写好的程序下载到单片机中,实现特定的功能。
AT89C52 单片机在通信方面也具备一定的能力。
它可以通过串行通信接口(UART)与其他设备进行数据交换。
这种通信方式在与计算机、传感器、显示屏等外部设备连接时非常有用。
例如,在数据采集系统中,单片机可以通过 UART 接口将采集到的数据发送给计算机进行进一步处理和分析。
AT89C52单片机介绍
AT89C52单片机介绍
AT89C52是Atmel公司生产的一款经典的8位单片机。
它采用MCS-51系列内核,具有高性能、低功耗和强大的外设功能。
AT89C52是AT89C51的改进版本,具有更高的运行速度和更大的存储空间。
首先,AT89C52采用了高性能的CMOS技术,工作频率高达40MHz,可以实现高效的数据处理和实时控制。
与普通的单片机相比,它具有更快的响应速度和更高的运算能力,可以满足复杂控制系统的要求。
其次,AT89C52具有8KB的内部闪存程序存储器,可以存储用户编写的程序代码。
它还具有256字节的RAM内存和128个IO口,可用于连接各种外部设备和传感器。
此外,AT89C52还支持多种通信接口,如UART、SPI和I2C,方便与其他设备进行数据交换和通信。
此外,AT89C52还具有丰富的开发资源和工具支持。
Atmel公司提供了一套完整的开发套件,包括编译器、调试器和仿真器等,为用户提供方便和高效的开发环境。
并且,AT89C52的软件编程接口也非常友好,可以使用C语言或汇编语言进行编程,灵活性很高。
总之,AT89C52是一款功能强大、性能稳定的8位单片机。
它具有高速运算能力、丰富的外设功能和灵活的IO口控制。
它可以广泛应用于各种控制系统、仪器仪表、家电和智能设备等领域。
同时,它的开发环境和编程接口也很友好,为用户提供了方便和高效的开发工具。
AT89C52 DATASHEETS 中文版
AT89C52 DatasheetsFeatures• Compatible with MCS-51™ Products• 8K Bytes of In-System Reprogrammable Flash Memory–Endurance: 1,000 Write/Erase Cycles• Fully Static Operation: 0 Hz to 24 MHz• Three-Level Program Memory Lock• 256 x 8-Bit Internal RAM• 32 Programmable I/O Lines• Three 16-Bit Timer/Counters• Eight Interrupt Sources• Programmable Serial Channel• Low Power Idle and Power Down ModesDescriptionThe AT89C52 is a low-power, high-performance CMOS 8-bit microcomputer with 8K bytes of Flash programmable and erasable read only memory (PEROM). The device is manufactured using Atmel’s high density nonvolatile memory technology and is compatible with the industry standard 80C51 and 80C52 instruction set and pinout.The on-chip Flash allows the program memory to be reprogrammed in-system or by a conventional nonvolatile memory programmer. By combining a versatile 8-bit CPU with Flash on a monolithic chip, the Atmel AT89C52 is a powerful microcomputer which provides a highly flexible and cost effective solution to many embedded control applications.The AT89C52 provides the following standard features: 8K bytes of Flash, 256 bytes of RAM,32 I/O lines, three 16-bit timer/counters, a six-vector two-level interrupt architecture,a full duplex serial port, on-chip oscillator, and clock circuitry.In addition, the AT89C52 is designed with static logic for operation down to zero frequency and supports two software selectable power saving modes. The Idle Mode stops the CPU while allowing the RAM, timer/counters,serial port, and interrupt system to continue functioning.The Power Down Mode saves the RAM contents but freezes the oscillator, disabling all other chip functions until the next hardware reset.Pin DescriptionVCCSupply voltage.GNDGround.Port 0Port 0 is an 8-bit open drain bidirectional I/O port. As an output port, each pin can sink eight TTL inputs. When 1s are written to port 0 pins, the pins can be used as highimpedance inputs. Port 0 can also be configured to be the multiplexed loworder address/data bus during accesses to external program and data memory. In this mode, P0 has internal pullups.Port 0 also receives the code bytes during Flash programming and outputs the code bytes during program verification. External pullups are required during program verification.Port 1Port 1 is an 8-bit bidirectional I/O port with internal pullups.The Port 1 output buffers can sink/source four TTL inputs.When 1s are written to Port 1 pins, they are pulled high by the internal pullups and can be used as inputs. As inputs,Port 1 pins that are externally being pulled low will source current (IIL) because of the internal pullups.In addition, P1.0 and P1.1 can be configured to be the timer/counter 2 external count input (P1.0/T2) and thetimer/counter 2 trigger input (P1.1/T2EX), respectively, as shown in the following table.Port 1 also receives the low-order address bytes during Flash programming and verification. Port 2Port 2 is an 8-bit bidirectional I/O port with internal pullups.The Port 2 output buffers can sink/source four TTL inputs.When 1s are written to Port 2 pins, they are pulled high by the internal pullups and can be used as inputs. As inputs,Port 2 pins that are externally being pulled low will source current (IIL) because of the internal pullups.Port 2 emits the high-order address byte during fetches from external program memory and during accesses to external data memory that use 16-bit addresses. In this application, Port 2 uses strong internal pull-ups when emitting 1s. During accesses to external data memory that use 8-bit addresses, Port 2 emits the contents of the P2 Special Function Register.Port 2 also receives the high-order address bits and some control signals during Flash programming and verification.Port 3Port 3 is an 8-bit bidirectional I/O port with internal pullups.The Port 3 output buffers can sink/source four TTL inputs.When 1s are written to Port 3 pins, they are pulled high by the internal pullups and can be used as inputs. As inputs,Port 3 pins that are externally being pulled low will source current (IIL) because of the pullups. Port 3 also serves the functions of various special features of the AT89C51, as shown in the following table.Port 3 also receives some control signals for Flash programming and verification.RSTReset input. A high on this pin for two machine cycles while the oscillator is running resets the device.ALE/PROGAddress Latch Enable is an output pulse for latching the low byte of the address during accesses to external memory.This pin is also the program pulse input (PROG) duringFlash programming.In normal operation, ALE is emitted at a constant rate of 1/6 the oscillator frequency and may be used for external timingor clocking purposes. Note, however, that one ALE pulse is skipped during each access to external data memory.If desired, ALE operation can be disabled by setting bit 0 of SFR location 8EH. With the bit set, ALE is active only during a MOVX or MOVC instruction. Otherwise, the pin is weakly pulled high. Setting the ALE-disable bit has no effect if the microcontroller is in external execution mode.PSENProgram Store Enable is the read strobe to external program memory.When the AT89C52 is executing code from external program memory, PSEN is activated twice each machine cycle, except that two PSEN activations are skipped during each access to external data memory. External Access Enable. EA must be strapped to GND in order to enable the device to fetch code from external program memory locations starting at 0000H up to FFFFH.Note, however, that if lock bit 1 is programmed, EA will be internally latched on reset.EA should be strapped to VCC for internal program executions.This pin also receives the 12-volt programming enable voltage(VPP) during Flash programming when 12-volt programmingis selected.XTAL1Input to the inverting oscillator amplifier and input to the internal clock operating circuit.XTAL2Output from the inverting oscillator amplifier.Special Function RegistersA map of the on-chip memory area called the Special Function Register (SFR) space is shown in Table 1. Note that not all of the addresses are occupied, and unoccupied addresses may not be implemented on the chip. Read accesses to these addresses will in general return random data, and write accesses will have an indeterminate er software should not write 1s to these unlisted locations,since they may be used in future products to invoke new features. In that case, the reset or inactive values of the new bits will always be 0.Timer 2 Registers: Control and status bits are contained in registers T2CON (shown in Table 2) and T2MOD (shown in Table 4) for Timer 2. The register pair (RCAP2H, RCAP2L) are the Capture/Reload registers for Timer 2 in 16-bit capture mode or 16-bit auto-reload mode. Interrupt Registers: The individual interrupt enable bits are in the IE register. Two priorities can be set for each of the six interrupt sources in the IP register.Data MemoryThe AT89C52 implements 256 bytes of on-chip RAM. The upper 128 bytes occupy a parallel address space to the Special Function Registers. That means the upper 128 bytes have the same addresses as the SFR space but are physically separate from SFR space.When an instruction accesses an internal location above address 7FH, the address mode used in the instruction specifies whether the CPU accesses the upper 128 bytes of RAM or the SFR space. Instructions that use direct addressing access SFR space.For example, the following direct addressinginstruction accesses the SFR at location 0A0H (which is P2).Instructions that use indirect addressing access the upper 128 bytes of RAM. For example, the following indirect addressing instruction, where R0 contains 0A0H, accesses the data byte at address 0A0H, rather than P2 (whose address is 0A0H).Note that stack operations are examples of indirect addressing, so the upper 128 bytes of data RAM are available as stack space.Timer 0 and 1Timer 0 and Timer 1 in the AT89C52 operate the same way as Timer 0 and Timer 1 in the AT89C51.Timer 2Timer 2 is a 16-bit Timer/Counter that can operate as either a timer or an event counter. The type of operation isselected by bit C/T2 in the SFR T2CON (shown in Table 2). Timer 2 has three operating modes: capture, auto-reload (up or down counting), and baud rate generator. The modes are selected by bits in T2CON, as shown in Table 3.Timer 2 consists of two 8-bit registers, TH2 and TL2. In the Timer function, the TL2 register is incremented every machine cycle. Since a machine cycle consists of 12 oscillator periods, the count rate is 1/12 of the oscillator frequency.In the Counter function, the register is incremented in response to a 1-to-0 transition at its corresponding external input pin, T2. In this function, the external input is sampled during S5P2 of every machine cycle. When the samples show a high in one cycle and a low in the next cycle, the count is incremented. The new count value appears in the register during S3P1 of the cycle following the one in which the transition was detected. Since two machine cycles (24 oscillator periods) are required to recognize a 1-to-0 transition, the maximum count rate is 1/24 of the oscillator frequency.To ensure that a given level is sampled at least once before it changes, the level should be held for at least one full machine cycle.Capture ModeIn the capture mode, two options are selected by bit EXEN2 in T2CON. If EXEN2 = 0, Timer 2 is a 16-bit timer or counter which upon overflow sets bit TF2 in T2CON. This bit can then be used to generate an interrupt. If EXEN2 = 1, Timer 2 performs the same operation, but a 1-to-0 transition at external input T2EX also causes the current value in TH2 and TL2 to be captured into RCAP2H and RCAP2L, respectively. In addition, the transition at T2EX causes bit EXF2 in T2CON to be set. The EXF2 bit, like TF2, can generate an interrupt. The capture mode is illustrated in Figure 1.Auto-Reload (Up or Down Counter)Timer 2 can be programmed to count up or down when configured in its 16-bit auto-reload mode. This feature is invoked by the DCEN (Down Counter Enable) bit located in the SFR T2MOD (see Table 4). Upon reset, the DCEN bit is set to 0 so that timer 2 will default to count up. When DCEN is set, Timer 2 can count up or down, depending on the value of the T2EX pin.Figure 2 shows Timer 2 automatically counting up when DCEN = 0. In this mode, two options are selected by bit EXEN2 in T2CON. If EXEN2 = 0, Timer 2 counts up to 0FFFFH and then sets the TF2 bit upon overflow. The overflow also causes the timer registers to be reloaded with the 16-bit value in RCAP2H and RCAP2L. The values in Timer in Capture ModeRCAP2H and RCAP2L are preset by software. If EXEN2 = 1, a 16-bit reload can be triggered either by an overflow or by a 1-to-0 transition at external input T2EX. This transition also sets the EXF2 bit. Both the TF2 and EXF2 bits can generate an interrupt if enabled. Setting the DCEN bit enablesTimer 2 to count up or down, as shown in Figure 3. In this mode, the T2EX pin controls the direction of the count. A logic 1 at T2EX makes Timer 2 count up. The timer will overflow at 0FFFFH and set the TF2 bit. This overflow also causes the 16-bit value in RCAP2H and RCAP2L to be reloaded into the timer registers, TH2 and TL2, respectively. A logic 0 at T2EX makes Timer 2 count down. The timer underflows when TH2 and TL2 equal the values stored in RCAP2H and RCAP2L. The underflow sets the TF2 bit and causes 0FFFFH to be reloaded into the timer registers. The EXF2 bit toggles whenever Timer 2 overflows or underflows and can be used as a 17th bit of resolution. In this operating mode, EXF2 does not flag an interrupt.Baud Rate GeneratorTimer 2 is selected as the baud rate generator by setting TCLK and/or RCLK in T2CON (Table 2). Note that the baud rates for transmit and receive can be different if Timer 2 is used for the receiver or transmitter and Timer 1 is used for the other function. Setting RCLK and/or TCLK puts Timer 2 into its baud rate generator mode, as shown in Figure 4.The baud rate generator mode is similar to the auto-reload mode, in that a rollover in TH2 causes the Timer 2 registersto be reloaded with the 16-bit value in registers RCAP2H and RCAP2L, which are preset by software.The baud rates in Modes 1 and 3 are determined by TimerThe Timer can be configured for either timer or counter operation. In most applications, it is configured for timer operation (CP/T2 = 0). The timer operation is different for Timer 2 when it is used as a baud rate generator. Normally, as a timer, it increments every machine cycle (at 1/12 the oscillator frequency). As a baud rate generator, however, it increments every state time (at 1/2 the oscillator frequency).where (RCAP2H, RCAP2L) is the content of RCAP2H and RCAP2L taken as a 16-bit unsigned integer. Timer 2 as a baud rate generator is shown in Figure 4. This figure is valid only if RCLK or TCLK = 1 in T2CON. Note that a rollover in TH2 does not set TF2 and will not generate an interrupt. Note too, that if EXEN2 is set, a 1-to-0 transition in T2EX will set EXF2 but will not cause a reload from (RCAP2H, RCAP2L) to (TH2, TL2). Thus when Timer 2 is in use as a baud rate generator, T2EX can be used as an extra external interrupt.Note that when Timer 2 is running (TR2 = 1) as a timer in the baud rate generator mode, TH2 or TL2 should not be read from or written to. Under these conditions, the Timer is incremented every state time, and the results of a read or write may not be accurate. The RCAP2 registers may be read but should not be written to, because a write might overlap a reload and cause write and/or reload errors. The timer should be turned off (clear TR2) before accessing the Timer 2 or RCAP2 registers. Programmable Clock OutA 50% duty cycle clock can be programmed to come out on P1.0, as shown in Figure 5. This pin, besides being a regular I/O pin, has two alternate functions. It can be programmedto input the external clock for Timer/Counter 2 or to output a 50% duty cycle clock ranging from 61 Hz to 4 MHz at a 16 MHz operating frequency. To configure the Timer/Counter 2 as a clock generator, bit C/T2 (T2CON.1) must be cleared and bit T2OE (T2MOD.1) must be set. Bit TR2 (T2CON.2) starts and stops the timer. The clock-out frequency depends on the oscillator frequency and the reload value of Timer 2 capture registers (RCAP2H, RCAP2L),In the clock-out mode, Timer 2 roll-overs will not generate an interrupt. This behavior is similar to when Timer 2 is used as a baud-rate generator. It is possible to use Timer 2 as a baud-rate generator and a clock generator simultaneously. Note, however, that the baud-rate and clock-out frequencies cannot be determined independently from one another since they both use RCAP2H and RCAP2L.UARTThe UART in the AT89C52 operates the same way as the UART in the AT89C51.InterruptsThe AT89C52 has a total of six interrupt vectors: two external interrupts (INT0 and INT1), three timer interrupts (Timers 0, 1, and 2), and the serial port interrupt. These interrupts are all shown in Figure 6.Each of these interrupt sources can be individually enabled or disabled by setting or clearing a bit in Special Function Register IE. IE also contains a global disable bit, EA, which disables all interrupts at once. Note that Table 5 shows that bit position IE.6 is unimplemented. In the AT89C51, bit position IE.5 is also unimplemented. User software should not write 1s to these bit positions, since they may be used in future AT89 products. Timer 2 interrupt is generated by the logical OR of bits TF2 and EXF2 in register T2CON. Neither of these flags is cleared by hardware when the service routine is vectored to. In fact, the service routine may have to determine whether it was TF2 or EXF2 that generated the interrupt, and that bit will have to be cleared in software. The Timer 0 and Timer 1 flags, TF0 and TF1, are set at S5P2 of the cycle in which the timers overflow. The values are then polled by the circuitry in the next cycle. However,the Timer 2 flag, TF2, is set at S2P2 and is polled in the same cycle in which the timer overflows.Oscillator CharacteristicsXTAL1 and XTAL2 are the input and output, respectively, of an inverting amplifier that can be configured for use as an on-chip oscillator, as shown in Figure 7. Either a quartz crystal or ceramic resonator may be used. To drive the device from an external clock source, XTAL2 should be left unconnected while XTAL1 is driven, as shown in Figure 8. There are no requirements on the duty cycle of the external clock signal, since the input to the internal clocking circuitry is through a divide-by-two flip-flop, but minimum and maximum voltage high and low time specifications must be observed.Idle ModeIn idle mode, the CPU puts itself to sleep while all the onchip peripherals remain active. The mode is invoked by software. The content of the on-chip RAM and all the special functions registers remain unchanged during this mode. The idle mode can be terminated by any enabled interrupt or by a hardware reset. Note that when idle mode is terminated by a hardware reset, the device normally resumes program execution from where it left off, up to two machine cycles before the internal reset algorithm takes control. On-chip hardware inhibits access to internal RAM in this event, but access to the port pins is not inhibited. To eliminate the possibility of an unexpected write to a port pin when idle mode is terminated by a reset, the instruction following the one that invokes idle mode should not write to a port pin or to external memory.Power Down ModeIn the power down mode, the oscillator is stopped, and the instruction that invokes power down is the last instruction executed. The on-chip RAM and Special Function Registersretain their values until the power down mode is terminated. The only exit from power down is a hardware reset. Reset redefines the SFRs but does not change the on-chip RAM. The reset should not be activated before VCC is restored to its normal operating level and must be held active long enough to allow the oscillator to restart and stabilize.Program Memory Lock BitsThe AT89C52 has three lock bits that can be left unprogrammed (U) or can be programmed (P)to obtain the additional features listed in the following table. When lock bit 1 is programmed, the logic level at the EA pin is sampled and latched during reset. If the device is powered up without a reset, the latch initializes to a random value and holds that value until reset is activated. The latched value of EA must agree with the current logic level at that pin in order for the device to function properly.Programming the FlashThe AT89C52 is normally shipped with the on-chip Flash memory array in the erased state (that is, contents = FFH) and ready to be programmed. The programming interface accepts either a high-voltage (12-volt) or a low-voltage (VCC) program enable signal. The low voltage programming mode provides a convenient way to program the AT89C52 ins ide the user’s system, while the high-voltage programming mode is compatible with conventional thirdparty Flash or EPROM programmers. The AT89C52 is shipped with either the high-voltage or low-voltage programming mode enabled. The respective top-side marking and device signature codes are listed in the following table. The AT89C52 code memory array is programmed byte-bybyte in either programming mode. To program any nonblank byte in the on-chip Flash Memory, the entire memory must be erased using the Chip Erase Mode.AT89C52数据手册AT89C51主要性能指数:1.与MCS-51产品指令和引脚完全相同2.8K字节可重擦写Flash闪速存储器3.1000次擦写周期4.全静态操作:0Hz-24Hz5.三级加密程序存储器6.256×8字节内部RAM7.32个可编程I/O口线8.3个16位定时器/计数器9.8个中断源10.可编程串行UART通道11.低功耗空闲和掉电模式功能特性概述:AT89C52提供以下标准功能:8K字节Flash闪速存储器,256字节内部RAM,32个I/O口线,3个16位定时/计数器,一个6向量两级中断结构,一个全双工串行通信口,片内振荡器及时钟电路。
51单片机AT89C52中文资料
51单片机AT89C52中文资料--------------------------------------------------------------------------------51单片机AT89C52中文资料AT89C52 ATMEL公司生产的低电压,高性能CMOS 8位单片机.片含8K byTES的可反复擦写的只读程序存储器(PEROM)和256 byTES 。
的随机存取数据存储器(RAM),器件采用ATMEL公司的高密度、非易失性存储技术生产,与标准MCS-51指令系统及8052 产品引脚兼容,片置通用8位中央处理器(CPU )和FLASH由存储单元,功能强大AT89C52单片适用于许多较为复杂控制应用场合。
主要性能参数:与Mcs-51产品指令和引脚完全兼容。
8字节可重擦写FLASH闪速存储器1000 次擦写周期全静态操作:0HZ-24MHZ三级加密程序存储器256X8字节部RAM32个可编程I/0口线3个16 位定时/计数器8个中断源可编程串行UART通道低功耗空闲和掉电模式部结构图AT89C52部框图功能特性:AT89C52 提供以下标准功能:8字节FLASH闪速存储器,256字竹部RAM , 32个I/O口线,3个16 位定时/计数器,一个6向量两级中断结构,一个全双工串行通信口,片振荡器及时钟电路。
同时,AT89c52可降至OHz的静态逻辑操作,并支持两种软件可选的节电上作模式。
空闲方式停止CPU 的工作,但允许RAM,定时/计数器.串行通信口及中断系统继续工作。
掉电方式保存RAM 中的容,但振荡器停止工作并禁止其它所有部件工作直到下一个硬件复位.功能引脚说明:Vcc:电源电压GND:地P0:P0口是一组8位漏极开路型双向1/O 口,也即地址/数据总线复用口。
作为输出口用时.每位能吸收电流的方式驱动8个TTL 逻辑门电路,对端口P0 写“1”时,可作为高阻抗输入端用。
at89c52单片机介绍
at89c52中文资料介绍AT89C52 ATMEL公司生产的低电压,高性能CMOS 8位单片机.片内含8K byTES的可反复擦写的只读程序存储器(PEROM)和256 byTES 。
的随机存取数据存储器(RAM),器件采用ATMEL公司的高密度、非易失性存储技术生产,与标准MCS-51指令系统及8052 产品引脚兼容,片内置通用8位中央处理器(CPU )和FLASH 由存储单元,功能强大AT89C52单片适用于许多较为复杂控制应用场合。
主要性能参数:与Mcs-51产品指令和引脚完全兼容。
8字节可重擦写FLASH闪速存储器1000 次擦写周期全静态操作:0HZ-24MHZ三级加密程序存储器256X8字节内部RAM32个可编程I/0口线3个16 位定时/计数器8个中断源可编程串行UART通道低功耗空闲和掉电模式AT89C52内部框图功能特性:AT89C52 提供以下标准功能:8字节FLASH闪速存储器,256字竹内部RAM , 32个I/O口线,3个16 位定时/计数器,一个6向量两级中断结构,一个全双工串行通信口,片内振荡器及时钟电路。
同时,AT89c52可降至OHz的静态逻辑操作,并支持两种软件可选的节电上作模式。
空闲方式停止CPU 的工作,但允许RAM,定时/计数器.串行通信口及中断系统继续工作。
掉电方式保存RAM 中的内容,但振荡器停止工作并禁止其它所有部件工作直到下一个硬件复位.功能引脚说明:Vcc:电源电压GND:地P0:P0口是一组8位漏极开路型双向1/O 口,也即地址/数据总线复用口。
作为输出口用时.每位能吸收电流的方式驱动8个TTL 逻辑门电路,对端口P0 写“1”时,可作为高阻抗输入端用。
在访问外部数据存储器或程序存储器时,这组口线分时转换地址(低8位)和数据总线复用,在访问期间激活内部上拉电阻。
在FLASH由编程时,P0口接收指令字节,而在程序校验时,输出指令字节,校验时,要求外接上拉电阻。
AT89C52_外文资料翻译译文
附件1:外文资料翻译译文AT89C52中文资料AT89C52是美国Atmel公司生产的低电压、高性能CMOS 8位单片机,片内含8KB的可反复檫写的程序存储器和12B的随机存取数据存储器(RAM),器件采用Atmel公司的高密度、非易失性存储技术生产,兼容标准MCS-51指令系统,片内配置通用8位中央处理器(CPU)和Flash存储单元,功能强大的AT89C52单片机可灵活应用于各种控制领域。
AT89C52单片机属于AT89C51单片机的增强型,与Intel公司的80C52在引脚排列、硬件组成、工作特点和指令系统等方面兼容。
其主要工作特性是:•与MCS-51产品指令和引脚完全兼容•8k字节可重擦写Flash闪速存储器•1000次擦写周期•具有3个可编程定时器•全静态操作:0Hz-24MHz•256×8字节内部RAM•32个可编程I/O口线•3个16位定时/计数器•8个中断源•可编程串行uart通道•低功耗空闲和掉电模式单片机正常工作时,都需要有一个时钟电路和一个复位电路。
本设计中选择了内部时钟方式和按键电平复位电路,来构成单片机的最小电路。
功能特性描述:AT89C52是一种低功耗、高性能CMOS8位微控制器,具有8K 在系统可编程Flash 存储器。
使用Atmel 公司高密度非易失性存储器技术制造,与工业80C51产品指令和引脚完全兼容。
片上Flash允许程序存储器在系统可编程,亦适于常规编程器。
AT89C52方框图P0 口:P0 口是一组8 位漏极开路型双向I/O 口,也即地址/数据总线复用口。
作为输出口用时,每位能吸收电流的方式驱动8 个TTL逻辑门电路,对端口P0 写“1”时,可作为高阻抗输入端用。
在访问外部数据存储器或程序存储器时,这组口线分时转换地址(低8 位)和数据总线复用,在访问期间激活内部上拉电阻。
在Flash 编程时,P0 口接收指令字节,而在程序校验时,输出指令字节,校验时,要求外接上拉电阻。
AT89C52中文资料
A T89C52中文资料电子驿站http:// E-mail: support@A T89C52是美国A TMEL公司生产的低电压,高性能CMOS 8位单片机,片内含8k bytes的可反复擦写的只读程序存储器(PEROM)和256 bytes的随机存取数据存储器(RAM),器件采用A TMEL公司的高密度、非易失性存储技术生产,与标准MCS-51指令系统及8052产品引脚兼容,片内置通用8位中央处理器(CPU)和Flash存储单元,功能强大A T89C52单片机适合于许多较为复杂控制应用场合。
主要性能参数:·与MCS-51产品指令和引脚完全兼容·8k字节可重擦写Flash闪速存储器·1000次擦写周期·全静态操作:0Hz-24MHz·三级加密程序存储器·256×8字节内部RAM·32个可编程I/O口线·3个16位定时/计数器·8个中断源·可编程串行UART通道·低功耗空闲和掉电模式功能特性概述:A T89C52提供以下标准功能:8k字节Flash闪速存储器,256字节内部RAM,32个I/O口线,3个16位定时/计数器,一个6向量两级中断结构,一个全双工串行通信口,片内振荡器及时钟电路。
同时,A T89C52可降至0Hz的静态逻辑操作,并支持两种软件可选的节电工作模式。
空闲方式停止CPU的工作,但允许RAM,定时/计数器,串行通信口及中断系统继续工作。
掉电方式保存RAM中的内容,但振荡器停止工作并禁止其它所有部件工作直到下一个硬件复位。
AT89C52方框图·P0口:P0口是一组8位漏极开路型双向I /O 口,也即地址/数据总线复用口。
作为输出口用时,每位能吸收电流的方式驱动8个TTL 逻辑门电路,对端口P0写“l ”时,可作为高阻抗输入端用。
在访问外部数据存储器或程序存储器时,这组口线分时转换地址(低8位)和数据总线复用,在访问期间激活内部上拉电阻。
AT89C52单片机介绍知识讲解
AT89C52单片机介绍在众多的单片机系列中,AT89C52是一种低功耗、高性能CMOS8位微控制器,具有8K在系列可编程Flash存储器。
使用Atmel公司高密度非易失性存储器技术制造,与工业80C51产品指令和引脚完全兼容。
片上Flash允许程序存储器在系统可编程,也适用于常规编程。
在单芯片上,拥有灵巧的8位CPU和在系统可编程Flash,使得AT89C52为众多嵌入式控制应用系统提供高灵活、超高效的解决方案。
AT89C52具有以下标准功能:8K字节Flash,256字节RAM,32位I/O口线,3个16位定时器/计数器,一个响亮2级中断结构,全双工串行口,片内晶振及时钟电路。
另外,AT89C52可降至0HZ静态逻辑操作,支持2种软件可选择节电模式。
空闲模式下,CPU停止工作,允许RAM、定时器/计数器、串口、中断继续工作。
掉电保护方式下,RAM内容被保存,振荡器被冻结,单片机一切工作停止,直到下一个中断或硬件复位为止。
AT89C52单片机为很多嵌入式控制系统提供了一种灵活性高且廉价的方案。
故此选用AT89C52单片机。
1 AT89C52单片机1.1 AT89C52单片机的硬件结构如图3-1所示,为AT89C52的硬件结构图。
AT89C52单片机的内部结构与MCS-51系列单片机的构成基本相同。
CPU是由运算器和控制器所构成的。
运算器主要用来对操作数进行算术、逻辑运算和位操作的。
控制器是单片机的指挥控制部件,主要任务的识别指令,并根据指令的性质控制单片机各功能部件,从而保证单片机各部分能自动而协调地工作。
它的程序存储器为8K字节可重擦写Flash闪速存储器,闪烁存储器允许在线+5V电擦除、电写入或使用编程器对其重复编程。
数据存储器比51系列的单片机相比大了许多为256字节RAM。
AT89C52单片机的指令系统和引脚功能与MCS-51的完全兼容。
图 3-1 单片机89C52结构框图1.2 主要性能参数• 8K字节可重擦写Flash闪速存储器• 1000次可擦写周期•全静态操作:0Hz-24MHz•三级加密程序存储器• 256×8字节内部RAM• 32个可编程I/O口线• 3个16位定时/计数器• 8个中断源•可编程串行UART通道•低功耗空闲和掉电模式图 3-2 AT89C52外部引脚图1.3 AT89C52管脚说明VCC:电源GND:接地P0口:P0口是一个8位漏级开路的双向I/O口。
AT89C52中文原理图规格书
Rev. 0313H–02/00
1
Block Diagram
VCC GND
RAM ADDR. REGISTER
P0.0 - P0.7 PORT 0 DRIVERS
P2.0 - P2.7 PORT 2 DRIVERS
RAM
PORT 0 LATCH
PORT 2 LATCH
QUICK FLASH
PORT 1 LATCH
PORT 3 LATCH
OSC
PORT 1 DRIVERS
PORT 3 DRIVERS
P1.0 - P1.7
P3.0 - P3.7
BUFFER
PC INCREMENTER
PROGRAM COUNTER
DPTR
2
AT89C52
AT89C52
The AT89C52 provides the following standard features: 8K bytes of Flash, 256 bytes of RAM, 32 I/O lines, three 16-bit timer/counters, a six-vector two-level interrupt architecture, a full-duplex serial port, on-chip oscillator, and clock circuitry. In addition, the AT89C52 is designed with static logic for operation down to zero frequency and supports two software selectable power saving modes. The Idle Mode stops the CPU while allowing the RAM, timer/counters, serial port, and interrupt system to continue functioning. The Power-down mode saves the RAM contents but freezes the oscillator, disabling all other chip functions until the next hardware reset.
at89c52单片机中英文资料对照外文翻译文献综述
D.htmlat89c52单片机中英文资料对照外文翻译文献综述at89c52单片机简介中英文资料对照外文翻译文献综述AT89C52 Single-chip microprocessor introductionSelection of Single-chip microprocessor1. Development of Single-chip microprocessorThe main component part of Single-chip microprocessor as a result of by such centralize to be living to obtain on the chip,In immediate future middle processor CPU。
Storage RAM immediately﹑memoy readROM﹑Interrupt system、Timer /'s counter along with I/O's rim electric circuit awaits the main microcomputer section,The lumping is living on the chip。
Although the Single-chip microprocessor r is only a chip,Yet through makes up and the meritorous service be able to on sees,It had haveed the calculating machine system property,calling it for this reason act as Single-chip microprocessor r minisize calculating machine SCMS and abbreviate the Single-chip microprocessor。
at89c52
Pin Description
VCC Supply voltage.
GND Ground.
Port 0
Port 0 is an 8-bit open drain bi-directional I/O port. As an output port, each pin can sink eight TTL inputs. When 1s are written to port 0 pins, the pins can be used as highimpedance inputs.
Port 0 can also be configured to be the multiplexed loworder address/data bus during accesses to external program and data memory. In this mode, P0 has internal pullups.
(WR) P3.6 18 (RD) P3.7 19
XTAL 2 20 XTAL1 21
GND 22 NC 23
(A8) P2.0 24 (A9) P2.1 25 (A10) P2.2 26 (A11) P1.7 9 RST 10 (RXD) P3.0 11
(A8) P2.0 18 (A9) P2.1 19 (A10) P2.2 20 (A11) P2.3 21 (A12) P2.4 22
6 P1.4 5 P1.3 4 P1.2 3 P1.1 (T2 EX) 2 P1.0 (T2) 1 NC 44 VCC 43 P0.0 (AD0) 42 P0.1 (AD1) 41 P0.2 (AD2) 40 P0.3 (AD3)
NC 6 (TXD) P3.1 7 (INT0) P3.2 8 (INT1) P3.3 9
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
at89c52中文资料介绍时间:2009-03-15 07:52:27 来源:频率计爱好者作者:编号:1181 更新日期20110302 073200AT89C52 ATMEL公司生产的低电压,高性能CMOS 8位单片机.片内含8K byTES的可反复擦写的只读程序存储器(PEROM)和256 byTES 。
的随机存取数据存储器(RAM),器件采用ATMEL公司的高密度、非易失性存储技术生产,与标准MCS-51指令系统及8052 产品引脚兼容,片内置通用8位中央处理器(CPU )和FLASH 由存储单元,功能强大AT89C52单片适用于许多较为复杂控制应用场合。
主要性能参数:与Mcs-51产品指令和引脚完全兼容。
8字节可重擦写FLASH闪速存储器1000 次擦写周期全静态操作:0HZ-24MHZ三级加密程序存储器256X8字节内部RAM32个可编程I/0口线3个16 位定时/计数器8个中断源可编程串行UART通道低功耗空闲和掉电模式AT89C52内部框图功能特性:AT89C52 提供以下标准功能:8字节FLASH闪速存储器,256字竹内部RAM , 32个I/O口线,3个16 位定时/计数器,一个6向量两级中断结构,一个全双工串行通信口,片内振荡器及时钟电路。
同时,AT89c52可降至OHz的静态逻辑操作,并支持两种软件可选的节电上作模式。
空闲方式停止CPU 的工作,但允许RAM,定时/计数器.串行通信口及中断系统继续工作。
掉电方式保存RAM 中的内容,但振荡器停止工作并禁止其它所有部件工作直到下一个硬件复位.功能引脚说明:Vcc:电源电压GND:地P0:P0口是一组8位漏极开路型双向1/O 口,也即地址/数据总线复用口。
作为输出口用时.每位能吸收电流的方式驱动8个TTL 逻辑门电路,对端口P0 写“1”时,可作为高阻抗输入端用。
在访问外部数据存储器或程序存储器时,这组口线分时转换地址(低8位)和数据总线复用,在访问期间激活内部上拉电阻。
在FLASH由编程时,P0口接收指令字节,而在程序校验时,输出指令字节,校验时,要求外接上拉电阻。
P1口:PI 是一个带内部上拉电阻的8位双向I/O口,Pl的输出缓冲级可驱动(吸收或输出电流)4个TTL逻辑门电路。
对端口写“1”,通过内部的上拉电阻把端口拉到高电平,此时可作输入口。
作输入口使用时,因为内部存在上拉电阻某个引脚被外部信号拉低时会输出一个电流IIL与AT89C51不同之处是,Pl.0 和P1.1还可分别作为定时/计数器2 的外部计数输入(Pl.0/T2 )和输入(P1.1/T2EX) ,参见表1FLASH编程和程序校验期间,Pl接收低8位地址。
表1 PI.O 和PI.l 的第二功能口:P2 是一个带有内部上拉电阻的8位双向I/O口,P2的输出缓冲级可驱动(吸收或输出电流)4个TTL逻辑电路。
对端口P2写“l",通过内部的上拉电阻把端口拉到高电平,此时可作输入口,作输入口使用时,因为内部存在上拉电阻,某个引脚被外部信号拉低时会输出一个电流(llt )。
在访问外部程序存储器或16位地址的外部数据存储器(例如执行MOvx@DPTR 指令)时,P2送出高8 位地址数据。
在访问8位地址的外部数据存储器、如执行MOVX@RI指令)时,P2口输出P2锁存器的内容。
FLASH编程或校验时,P2亦接收高位地址和一些控制信号。
·P3口:P3口是一组带有内部上拉电阻的8位双向I/O口。
P3口输出缓冲级可驱动(吸收或输出电流)4个TTL逻辑门电路。
对P3口写入“1”时,它们被内部上拉电阻拉高并可作为输入端口。
此时,被外部拉低的P3口将用上拉电阻输出电流(IIL) .P3口除了作为一般的I/0口线外,更重要的用途是它的第二功能,此外,P3口还接收一些用于FLASH闪速存储器编程和程序校验的控制信号。
RST:复位输入。
当振荡器工作时,RST引脚出现两个机器周期以上高电平将使单片机复位。
·ALE/PROG:当访问外部程序存储器或数据存储器时,ALE(地址锁存允许)输出脉冲用于锁存地址的低8位字节.一般情况下,ALE仍以时钟振荡频率的1/6输出固定的脉冲信号,因此它可对外输出时钟或用于定时目的。
要注意的是:每当访问外部数据存储器时将跳过一个ALE脉冲。
对Flash存储器编程期间,该引脚还用于输入编程脉冲(PROG)。
如有必要,可通过对特殊功能寄存器(SFR)区中的8EH单元的D0位置位.可禁止ALE操作。
该位置位后,只有一条MOVX和MOVC指令才能将ALE激活,此外,该引脚会被微弱拉高,单片机执行外部程序时,应设置ALE禁止位无效。
·PSEN:程序储存允许PSEN输出是外部程序存储器的读选通信号,当AT89C52由外部程序存储器取指令(或数据)时,每个机器周期两次PSEN有效,即输出两个脉冲。
在此期间,当访问外部数据存储器,将跳过两次PSEN信号。
·EA/VPP:外部访问允许。
欲使CPU 仅访问外部程序存储器(地址为0000H-FFFFH ) , EA端必须保持低电平(接地).需注怠的是:如果加密位LBI被编程,复位时内部会锁存EA端状态。
如EA端为高电平(接Vcc端), CPU则执行内部程序存储器中的指令。
flash存储器编程时,该引脚加上+12V的编程允许电源VPP ,当然这必须是该器件是使用12V编程电压VPP 。
·XTAL1:振荡器反相放大器的及内部时钟发生器的输入端.·XTAL1:振荡器反相放大器的输出端。
,特殊功能寄存器:在AT89C52片内存储器中,80H-FFH共128个单元为特殊功能寄存器(SFE ) , SFR的地址空间映象如表2所示。
并非所有的地址都被定义,从80H-FFH共128 个字节只有一部分被定义,还有相当一部分没有定义。
对没有定义的单元读写将是无效的,读出的数位将不确定,而写入的数据也将丢失。
不应将数据"1"写入未定义的单元,由于这些单元在将来的产品中可能赋予新的功能,在这种情况下,复位后这些单元数值总是“0”。
表2 AT89C52 SFR 映象及复位状态AT89C52除了与AT89C51所有的定时/计数器0和定时/计数器1 外,还增加了一个定时/计数器2 .定时/计数器2的控制和状态位位于T2CON (参见表3) T2CON(参见表4) ,寄存器对(RCA02H、RCAP2L)是定时器2在16 位捕获方式或16位自动重装载方式下的捕获/自动重装载寄存器。
表3 定时/计数器2控制寄存器T2CON中断寄存器:AT89C52有6个中断源,2个中断优先级,lE寄存器控制各中断位,lP寄存器中6个中断源的每一个可定为2个优先级。
数据存储器AT89C52有256个字节的内部RAM , 80H-FFH高128个字节与特殊功能寄存器(SFR)地址是重叠的,也就是高128字竹的RAM和殊功能寄存器的地址是相同的,但物理上它们是分开的。
当一条指令访问7FH以上的内部地址单元时,指令中使用的寻址方式是不同的,也即寻址方式决定是访问高128字节RAM还是访问特殊功能寄存器。
如果指令是直接寻址方式则为访问特殊功能寄存器.例如,下面的直接寻址指令访问特殊功能寄存器0A0H(即P2口)地址单元。
MOV 0A0H ,#data间接寻址指令访问高128字节RAM ,例如下面的间接子址指令中,R0的内容为OAOH ,则访问数据字节地址为0A0H , 而不是P2口(0A0H )。
MOV @RO ,#data堆栈操作也是间接寻址方式,所以,高128位数据RAM亦可作为堆栈区使用。
定时器O和定时器1AT89C52的定时器O和定时器1的工作方式与AT89C51相同。
定时2定时器2是一个16位定时计数器。
它既可当定时器使用,也可作为外部事件计数器使用,其工作方式由特殊功能寄存器T2CON(如表3 )的C/T2位选择。
定时器2有三种工作方式:捕获方式,自动重装载(向上或向下计数)方式和波特率发生器方式,工作方式由T2CON的控制位来选择,参见表4 。
表4 定时器2 工作方式定时器2由两个8位寄存器TH2和TL2组成,在定时器工作方式中,每个机器周期TL2寄存器的值加1 ,由于一个机器周期由12个振荡时钟构成,因此,计数速率为振荡频率的1/l2 。
在计数工作方式时,当T2引脚上外部输入信号产生由1至O的下降沿时,寄存器的值加1,在这种工作方式下,每个机器周期的5SP2期间,对外部输入进行采样。
若在第一个机器周期中采到的值为1,而在下一个机器周期中采到的值为0 , 则在紧跟着的下一个周期的S3P1期间寄存器加l 。
由于识别1至0的跳变需要2个机器周期(24个振荡周期),因此,最高计数速率为振荡频率的1/24 .为确保采样的正确性,要求输入的电平在变化前至少保持一个完整周期的时间,以保证输入信号至少被采样一次.捕获方式:在捕获方式下,通过T2CON控制位以EXEN2来选抒两种方式。
如果ExEN2=0,定时器2是一个16位定时器或计数器,计数溢出时,对T2CON溢出标志TFZ置位,同到激活中断。
如果EXEN2=1,定时器2完成相同的操作,而当T2EX引脚外部输入信号发生l至0负跳变时,也出现TH2和TL2中的值分别被捕获到RCAP2H和RCAP2L中.另外,T2EX引脚信号的跳变使得T2CON中的EXF2置位,与TF2相仿,EXF2也会激活中断。
捕获方式如图4 所示。
自动重装载(向上或向下计数器)方式:当定时器2工作于16位自动重装载方式时,能对其编程为向上或向下计数方式,这个功能可通过特殊功能寄存器T2CON(见表5)的DCEN 位(允许向下计数)来选择的。
复位时,DCEN位置“0 " ,定时器2默认设置为向上计数。
当DCEN置位时,定时器2既可向上计数也可向下计数,这取决于T2EX引脚的值,参见图5 ,当DCEN=0时,定时器2自动设置为向上计数,在这种方式下,T2CON中的EXEN2控制位有两种选择,若EXEN2,定时器2为向上计数至OFFFFH溢出,置位TF2激活中断,同时把16位计数寄存器RCAP2H和RCAP2L重装载,RCAP2H 和RCAP2L的值可由软件预置。
若EXEN2=1 ,定时器2的16位重装载由溢出或外部输入端T2EX从1至0的下降沿触发。
这个脉冲使EXF2置位,如果中断允许,同样产生中断。
当DCEN=1时,允许定时器2向上或向下计数,如图6所示。
这种方式下,T2EX引脚控制计数器方向。
T2EX以引脚为逻辑“1”时.定时器向上计数,当计数OFFFFH向上溢出时,置位TF2,同时把16位计数寄存器RCAP2H和RCAP2L 重装载到TH2和TL2中。