AT_89C51中英文翻译资料.pdf_第1页
AT_89C51中英文翻译资料.pdf_第2页
AT_89C51中英文翻译资料.pdf_第3页
AT_89C51中英文翻译资料.pdf_第4页
AT_89C51中英文翻译资料.pdf_第5页
已阅读5页,还剩11页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

The Introduction of AT 89C51 Description The AT89C51 is a low power high performance CMOS 8 bit microcomputer with 4K 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 MCS 51 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 AT89C51 is a powerful microcomputer which provides a highly flexible and cost effective solution to many embedded control applications Function characteristic The AT89C51 provides the following standard features 4K bytes of Flash 128 bytes of RAM 32 I O lines two 16 bit timer counters a five vector two level interrupt architecture a full duplex serial port on chip oscillator and clock circuitry In addition the AT89C51 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 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 2 highimpedance inputs Port 0 may 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 1 Port 1 is an 8 bit bi directional 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 Port 1 also receives the low order address bytes during Flash programming and verification Port 2 Port 2 is an 8 bit bi directional 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 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 it uses strong internal pullupswhen 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 3 Port 3 is an 8 bit bi directional 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 3 serves the functions of various special features of the AT89C51 as listed below Port 3 also receives some control signals for Flash programming and verification RST Reset input A high on this pin for two machine cycles while the oscillator is running resets the device ALE PROG Address Latch Enable output pulse for latching the low byte of the address during accesses to external memory This pin is also the program pulse input PROG during Flash programming In normal operation ALE is emitted at a constant rate of 1 6 the oscillator frequency and may be used for external timing or 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 PSEN Program Store Enable is the read strobe to external program memory When the AT89C51 is executing code from external program memory PSEN is activated twice each 4 machine cycle except that two PSEN activations are skipped during each access to external data memory EA VPP 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 for parts that require12 volt VPP XTAL1 Input to the inverting oscillator amplifier and input to the internal clock operating circuit XTAL2 Out put from the inverting oscillator amplifier Oscillator Characteristics XTAL1 and XTAL2 are the input and output respectively of an inverting amplifier which can be configured for use as an on chip oscillator as shown in Figure 1 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 2 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 5 Figure 1 Oscillator Connections Figure 2 External Clock Drive Configuration Idle Mode In 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 It should be noted that when idle is terminated by a hard ware 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 is terminated by reset the instruction following the one that invokes Idle should not be one that writes to a port pin or to external memory Power down Mode In 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 6 Registers retain 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 Bits On the chip are three lock bits which can be left unprogrammed U or can be programmed P to obtain the additional features listed in the table below 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 It is necessary that the latched value of EA be in agreement with the current logic level at that pin in order for the device to function properly Programming the Flash The AT89C51 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 7 low voltage programming mode provides a convenient way to program theAT89C51 inside the user s system while the high voltage programming mode is compatible with conventional third party Flash or EPROM programmers The AT89C51 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 AT89C51 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 Programming Algorithm Before programming theAT89C51 the address data and control signals should beset up according to the Flash programming mode table To program the AT89C51 take the following steps 1 Input the desired memory location on the address lines 2 Input the appropriate data byte on the data lines 3 Activate the correct combination of control signals 4 Raise EA VPP to 12V for the high voltage programming mode 5 Pulse ALE PROG once to program a byte in the Flash array or the lock bits The byte write cycle is self timed and typically takes no more than 1 5 ms Repeat steps 1 through 5 changing the address and data for the entire array or until the end of the object file is reached Data Polling The AT89C51 features Data Polling to indicate the end of a write cycle During a write cycle an attempted read of the last byte written will result in the complement of the written datum on PO 7 Once the write cycle has been completed true data are valid on all outputs and the next cycle may begin Data Polling may begin any time after a write cycle has been initiated Ready Busy The progress of byte programming can also be monitored by the RDY BSY output signal P3 4 is pulled low after ALE goes high during programming to indicate BUSY P3 4 is pulled high again when programming is done to indicate READY 8 Program Verify If lock bits LB1 and LB2 have not been programmed the programmed code data can be read back via the address and data lines for verification The lock bits cannot be verified directly Verification of the lock bits is achieved by observing that their features are enabled Chip Erase The entire Flash array is erased electrically by using the proper combination of control signals and by holding ALE PROG low for 10 ms The code array is written with all 1 s The chip erase operation must be executed before the code memory can be re programmed Reading the Signature Bytes The sign ature bytes are read by the same procedure as a normal verification of locations 030H 031H and 032H except that P3 6 andP3 7 must be pulled to a logic low The values returned are as follows 030H 1EH indicates manufactured by Atmel 031H 51H indicates 89C51 032H FFH indicates 12V programming 032H 05H indicates 5V programming Programming Interface Every code byte in the Flash array can be written and the entire array can be erased by using the appropriate combination of control signals The write operation cycle is self timed and once initiated will automatically time itself to completion All major programming vendors offer worldwide support for the Atmel microcontroller series Please contact your local programming vendor for the appropriate software revision 9 AT89C51AT89C51AT89C51AT89C51 的介绍的介绍的介绍的介绍 述 述 述 述 AT89C51 是一个 电压 高性能 CMOS8 单片机带有 4K 节的 复擦写的 程序 储器 PENROM 和 128 节的 数据 储器 RAM 种器件采用 ATMEL 公 的高密度 容易丢失 储技术生产 并 能够 MCS 51 系列的单片 10 机兼容 片内含有 8 中央处理器和闪烁 储单元 有较强的 能的 AT89C51 单片 机能够被 用到 制领域中 能特性 能特性 能特性 能特性 AT89C51 提供 的 能标准 4K 节闪烁 储器 128 节随机 数据 储器 32 个 I O 口 2 个 16 定时 计数器 1 个 5 向 级中断结构 1 个串行通信 口 片内震荡器和时钟电路 另外 AT89C51 进行 0HZ 的静态逻辑操作 并 支持 种 件的节电模式 闲散方式停 中央处理器的工作 能够允许随机 数据 储器 定时 计数器 串行通信口及中断系统继续工作 掉电方式保 随机 数 据 储器中的内容 但震荡器停 工作并禁 其它所有部件的工作直到 一个复 引脚 述引脚 述引脚 述引脚 述 VCC 电源电压 GND 地 P0 口口口口 P0 口是一组 8 漏极开路 向 I O 口 即地址 数据总线复用口 作为输出口时 一个管脚都能够驱动 8 个 TTL 电路 当 1 被写入 P0 口时 个管脚都能够作为 高阻抗输入端 P0 口 能够在 问外部数据 储器或程序 储器时 转换地址和数 据总线复用 并在 时激活内部的 拉电阻 P0 口在闪烁编程时 P0 口接收指 在程序校验时 输出指 需要接电阻 P1 口口口口 P1 口一个带内部 拉电阻的 8 向 I O 口 P1 的输出缓冲级 驱动 4 个 TTL 电路 对端口写 1 通过内部的电阻把端口拉到高电 时 作为输入口 因为 内部有电阻 某个引脚被外部信 拉 时输出一个电流 闪烁编程时和程序校验时 P1 口接收 8 地址 P2 口口口口 11 P2 口是一个内部带有 拉电阻的 8 向 I O 口 P2 的输出缓冲级 驱动 4 个 TTL 电路 对端口写 1 通过内部的电阻把端口拉到高电 时 作为输入口 因为内部有电阻 某个引脚被外部信 拉 时会输出一个电流 在 问外部程序 储 器或 16 地址的外部数据 储器时 P2 口 出高 8 地址数据 在 问 8 地址的 外部数据 储器时 P2 口线 的内容在整个运行期间 闪烁编程或校验时 P2 口接收高 地址和其它 制信 P3 口口口口 P3 口是一组带有内部电阻的 8 向 I O 口 P3 口输出缓冲故 驱动 4 个 TTL 电路 对 P3 口写如 1 时 它们被内部电阻拉到高电 并 作为输入端时 被外部拉 的 P3 口将用电阻输出电流 P3 口除了作为一般的 I O 口外 更重要的用途是它的第 能 如 表所示 端口引脚 第 能 P3 0 RXD P3 1 TXD P3 2 INT0 P3 3 INT1 P3 4 T0 P3 5 T1 P3 6 WR P3 7 RD P3 口 接收一些用于闪烁 储器编程和程序校验的 制信 RST 复 输入 当震荡器工作时 RET 引脚出现 个机器周期 的高电 将使单 片机复 ALE PROG 当 问外部程序 储器或数据 储器时 ALE 输出脉冲用于锁 地址的 8 节 即使 问外部 储器 ALE 时钟震荡频率的 1 16 输出固定的 脉冲信 12 因 它 对输出时钟或用于定时目的 要注意的是 当 问外部数据 储器时将跳 过一个 ALE 脉冲时 闪烁 储器编程时 个引脚 用于输入编程脉冲 如果 要 对特殊寄 器区中的 8EH 单元的 D0 置禁 ALE 操作 个 置 只有一条 MOVX 和 MOVC 指 ALE 才会被 用 外 个引脚会微弱拉高 单片机执行 外部程序时 置 ALE 无效 PSEN 程序储 允许输出是外部程序 储器的读选通信 当 AT89C51 由外部程序 储器读 指 时 个机器周期 次 PSEN 有效 即输出 个脉冲 在 期间 当 问外部数据 储器时 次有效的 PSEN 信 出现 EA VPP 外部 问允许 欲使中央处理器仅 问外部程序 储器 EA 端 须保持 电 需要注意的是 如果 密 LBI 被编程 复 时内部会锁 EA 端状态 如 EA 端为 高电 CPU 则执行内部程序 储器中的指 闪烁 储器编程时 该引脚 12V 的编程允许电压 VPP 当然 须是该器件是使用 12V 编程电压 VPP XTAL1 震荡器 相放大器及内部时钟发生器的输入端 XTAL2 震荡器 相放大器的输出端 时钟震荡器时钟震荡器时钟震荡器时钟震荡器 AT89C51 中有一个用于构 内部震荡器的高增益 相放大器 引脚 XTAL1 和 XTAL2 别是该放大器的输入端和输出端 个放大器 作为 馈元件的片外石英 晶体或陶瓷谐振器一起构 自然震荡器 外接石英晶体及电容 C1 C2 接在放大器 的 馈回路中构 并联震荡电路 对外接电容 C1 C2 虽然没有十 格的要求 但 电容容 的大小会轻微影响震荡频率的高 震荡器工作的稳定性 起振的难易程序 及温度稳定性 如果使用石英晶体 们 荐电容使用 30PF 10PF 而如果使用陶瓷 振荡器建议选择 40PF 10PF 用户也 采用外部时钟 采用外部时钟的电路如图示 种情况 外部时钟脉冲接到 XTAL1 端 即内部时钟发生器的输入端 XTAL2 则 悬空 由于外部时钟信 是通过一个 2 频触发器 作为内部时钟信 的 所 对外 13 部时钟信 的占空比没有特殊要求 但最小高电 持续时间和最大的 电 持续时间 符合产品技术条件的要求 内部振荡电路 外部振荡电路 闲散节电模式闲散节电模式闲散节电模式闲散节电模式 AT89C51 有 种 用 件编程的省电模式 它们是闲散模式和掉电工作模式 种方式是 制 用寄 器 PCON 中的 PD 和 IDL 来实现的 PD 是掉电模式 当 PD 1 时 激活掉电工作模式 单片机进入掉电工作状态 IDL 是闲散等待方式 当 IDL 1 激活闲散工作状态 单片机进入睡 状态 如需要 时进入 种工作模式 即 PD 和 IDL 时为 1 则先激活掉电模式 在闲散工作模式状态 中央处理器 CPU 保持睡 状态 而所有片内的外 保持激活状态 种方式由 件产生 时 片 内随机 数据 储器和所有特殊 能寄 器的内容保持 闲散模式 由任何允 许的中断请求或硬件复 终 终 闲散工作模式的方法有 种 一是任何一条被允 许中断的 件被激活 IDL 被硬件清除 即刻终 闲散工作模式 程序会首先影响中 断 进入中断服 程序 执行完中断服 程序 并紧随 RETI 指 一条要执行 的指 就是使单片机进入闲散工作模式 那条指 面的一条指 是通过硬件复 也 将闲散工作模式终 需要注意的是 当由硬件复 来终 闲散工作模式时 中央处理器 CPU 通常是 激活空闲模式那条指 的 一条开始继续执行程序的 要 完 内部复 操作 硬件复 脉冲要保持 个机器周期有效 在 种情况 内部禁 14 中央处理器 CPU 问片内 RAM 而允许 问其他端口 为了避免 能对端口产生 的意外写入 激活闲散模式的那条指 面的一条指 是一条对端口或外部 储 器的写入指 掉电模式掉电模式掉电模式掉电模式 在掉电模式 振荡器停 工作 进入掉电模式的指 是最 一条被执行的指 片内 RAM 和特殊 能寄 器的内容在中指掉电模式前被冻结 出掉电模式的唯一 方法是硬件复 复 将

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论