单片机中英文.doc

上传人:豆**** 文档编号:17506627 上传时间:2022-05-24 格式:DOC 页数:15 大小:266KB
返回 下载 相关 举报
单片机中英文.doc_第1页
第1页 / 共15页
单片机中英文.doc_第2页
第2页 / 共15页
点击查看更多>>
资源描述

《单片机中英文.doc》由会员分享,可在线阅读,更多相关《单片机中英文.doc(15页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。

1、【精品文档】如有侵权,请联系网站删除,仅供学习与交流单片机中英文.精品文档.An Overview of AT89S51The AT89S51 is a low-power, high-performance CMOS 8-bit microcontroller with 4K bytes of In-System Programmable Flash memory. The device is manufactured using Atmels high-density nonvolatile memory technology and is compatible with the indu

2、stry-standard 80C51 instruction set and pin out. 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 In-System Programmable Flash on a monolithic chip, the Atmel AT89S51 is a powerful mic

3、rocontroller which provides a highly-flexible and cost-effective solution to many embedded control applications. Features:Compatible with MCS.-51 Products4K Bytes of In-System Programmable (ISP) Flash MemoryEndurance: 1000 Write/Erase Cycles4.0V to 5.5V Operating RangeFully Static Operation: 0 Hz to

4、 33 MHzThree-level Program Memory Lock128 x 8-bit Internal RAM32 Programmable I/O LinesTwo 16-bit Timer/CountersSix Interrupt SourcesFull Duplex UART Serial ChannelLow-power Idle and Power-down ModesInterrupt Recovery from Power-down ModeWatchdog TimerDual Data PointerPower-off FlagFast Programming

5、TimeFlexible ISP Programming (Byte and Page Mode)Green (Pb/Halide-free) Packaging OptionThe AT89S51 provides the following standard features: 4K bytes of Flash, 128 bytes of RAM, 32 I/O lines, Watchdog timer, two data pointers, two 16-bit timer/counters, a five-vector two-level interrupt architectur

6、e, a full duplex serial port, on-chip oscillator, and clock circuitry. In addition, the AT89S51 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,

7、 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 external interrupt or hardware reset.VCC:Supply voltage (all packages except 42-PDIP).GND:Ground (all packages except 42-PDIP; for 4

8、2-PDIP GND connects only the logic core and the embedded program memory).VDD:Supply voltage for the 42-PDIP which connects only the logic core and the embedded program memory.PWRVDD:Supply voltage for the 42-PDIP which connects only the I/O Pad Drivers. The application board MUST connect both VDD an

9、d PWRVDD to the board supply voltage.PWRGND:Ground for the 42-PDIP which connects only the I/O Pad Drivers. PWRGND and GND are weakly connected through the common silicon substrate, but not through any metal link. The application board MUST connect both GND and PWRGND to the board ground.Port 0:Port

10、 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 high-impedance inputs.Port 0 can also be configured to be the multiplexed low-order address/data bus during accesses to external progr

11、am and data memory. In this mode, PO has internal pull-ups. Port 0 also receives the code bytes during Flash programming and outputs the code bytes during program verification. External pull-ups are required during program verification.Port 1:Port 1 is an 8-bit bi-directional I/O port with internal

12、pull-ups. 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 pull-ups and can be used as inputs. As inputs, Port 1 pins that are externally being pulled low will source current (lip) because of the internal pull-ups.Por

13、t 2:Port 2 is an 8-bit bi-directional I/O port with internal pull-ups. 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 pull-ups and can be used as inputs. As inputs, Port 2 pins that are externally being pulled low w

14、ill source current (lip) because of the internal pull-ups.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 (MOVXDPTR). In this application, Port 2 uses strong internal pull-ups when emitting 1s.

15、 During accesses to external data memory that use 8-bit addresses (MOVXRI), 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 p

16、ort with internal pull-ups. 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 pull-ups and can be used as inputs. As inputs, Port 3 pins that are externally being pulled low will source current (lip) because of the pul

17、l-ups.Port 3 receives some control signals for Flash programming and verification.Port 3 also serves the functions of various special features of the AT89S51,as shown in the following table.P3 port can also be used as a number of special features AT89C51 mouth, the following table:PinAlternative fun

18、ctionP3.0 RXD(Serial input)P3.1 TXD(Serial output)P3.2 (External interrupt 0)P3.3 (External interrupt 1)P3.4 T0(Timer 0 External input)P3.5 T1(Timer 1 External input)P3.6 (External data memory write strobe)P3.7 (External data memory read strobe)RST:Reset input. A high on this pin for two machine cyc

19、les while the oscillator is running resets the device. This pin drives High for 98 oscillator periods after the Watchdog times out. The DISRTO bit in SFR AUXR (address 8EH) can be used to disable this feature. In the default state of bit DISRTO, the RESET HIGH out feature is enabled.ALE/PROG:Address

20、 Latch Enable (ALE) 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) during Flash programming. In normal operation, ALE is emitted at a constant rate of 1/6 the oscillator frequency and may be used for ext

21、ernal 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 wea

22、kly pulled high. Setting the ALE-disable bit has no effect if the microcontroller is in external execution mode.PSEN:Program Store Enable (PSEN) is the read strobe to external program memory.When the AT89S51 is executing code from external program memory, PSEN is activated twice each machine cycle,

23、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 OOOOH up to FFFFH. Note, however, that if lock bit 1 is pro

24、grammed, 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.XTAL1:Input to the inverting oscillator amplifier and input to the internal clock operating circ

25、uit.XTAL2:Output from the inverting oscillator amplifierSpecial Function Registers: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 indete

26、rminate effect.User software should not write 1 s 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.Interrupt Registers:The individual interrupt enable bits are in the IE register

27、. Two priorities can be set for each of the five interrupt sources in the IP register.Dual Data Pointer Registers: To facilitate accessing both internal and external data memory, two banks of 16-bit Data Pointer Registers are provided: DPO at SFR address locations 82H-83H and DP1 at 84H-85H.Bit DPS=

28、0 in SFR AUXR1 selects DPO and DPS=1 selects DP1. The user should ALWAYS initialize the DPS bit to the appropriate value before accessing the respective Data Pointer Register.Power Off Flag: The Power Off Flag (POF) is located at bit 4 (PCON.4) in the PCON SFR. POF is set to 1”during power up. It ca

29、n be set and rest under software control and is not affected by reset.Memory Organization:MCS-51 devices have a separate address space for Program and Data Memory. Up to 64Kbytes each of external Program and Data Memory can be addressed.Program Memory:If the EA pin is connected to GND, all program f

30、etches are directed to external memory. On the AT89S51,if EA is connected to Vcc, program fetches to addresses OOOOH through FFFH are directed to internal memory and fetches to addresses 1000H through FFFFH are directed to external memory.Data Memory:The AT89S51 implements 128 bytes of on-chip RAM.

31、The 128 bytes are accessible via direct and indirect addressing modes. Stack operations are examples of indirect addressing, so the 128 bytes of data RAM are available as stack space.Watchdog Timer (One-time Enabled with Reset-out):The WDT is intended as a recovery method in situations where the CPU

32、 may be subjected to software upsets. The WDT consists of a 14-bit counter and the Watchdog Timer Reset (WDTRST) SFR. The WDT is defaulted to disable from exiting reset. To enable the WDT, a user must write 01 EH and OE1 H in sequence to the WDTRST register(SFR location OA6H). When the WDT is enable

33、d, it will increment every machine cycle while the oscillator is running. The WDT timeout period is dependent on the external clock frequency. There is no way to disable the WDT except through reset (either hardware reset or WDT overflow reset). When WDT overflows, it will drive an output RESET HIGH

34、 pulse at the RST pin.The use of watchdog (WDT):WDT to be open to write 01EH and 0E1H in sequence to WDTRST registers (SFRs address 0A6H), when the WDT opened, take some time to 01EH and 0E1H to WDTRST count register in order to avoid WDT overflow. WDT counter 14 count reached 16383 (3FFFH), WDT wil

35、l overflow and reset the device. WDT is turned on, it will be with the crystal oscillator in each machine cycle count, which means that users must be less than 16,383 machines each cycle reset WDT, that is to write 01EH and 0E1H to WDTRST register, WDTRST write only register. WDT counter can not be

36、read neither write, when the WDT overflows, it is usually RST pin will reset the output of high pulse. Reset pulse duration for the 98 Tosc, and Tosc = 1/Fosc (crystal oscillation frequency).In order to optimize the work WDT must be at the right time code WDT reset periodically to prevent the WDT ov

37、erflow.89 s51 SCM interrupt system is introduced.1. interrupt: the execution of a program, allowing external or internal events through hardware interrupt execution, make its steering for handling internal events in the interrupt service routine to;After finishing the interrupt service program, the

38、CPU to continue the original interrupted process, this process is called the interrupt.2. interrupt source: external and internal events can generate interrupts.89 s51 has five interrupt source:(1) INT0: external interrupt 0 request, low level effectively.Through P3.2 input pin.(2) the INT1: externa

39、l interrupt request 1, low level effectively.Through P3.3 input pin.(3) T0 timer/counter 0 overflow interrupt request.(4) TI: timer/counter 1 overflow interrupt request.(5) the TXD/RXD: serial port interrupt request.When the serial port in the completion of a frame of data sent or received, then req

40、uest the interrupt.Every interrupt source corresponds to an interrupt request flags, they set up in the special function registers TCON and SCON.When the interrupt request interrupt source, the corresponding marks have TCON and SCON respectively the corresponding latches.3. 89 s51 interrupt system h

41、as the following four special function register:(1) the timer control register TCON (6);(2) serial port control register SCON (2);(3) IE interruption allows register;(4) interrupt priority register IP.Among them, the TCON and SCON part is only used to interrupt control.By you of any of the above spe

42、cial function register for operation, such as setting or reset all sorts of interrupt control functions can be realized.翻译单片机AT89S51的概述AT89S51是美国ATMEL公司生产的低功耗,高性能CMOS 8位单片机,片内含4k bytes的可系统编程的Flash只读程序存储器,器件采用ATMEL公司的高密度、非易失性存储技术生产,兼容标准8051指令系统及引脚。它集Flash程序存储器既可在线编程(ISP)也可用传统方法进行编程及通用8位微处理器于单片芯片中,ATM

43、EL公司的功能强大,低价位AT89S51单片机可为您提供许多高性价比的应用场介,可灵活应用于各种控制领域。主要性能参数:与MCS-51 产品指令系统完全兼容4k字节在线系统编程(ISP) Flash闪速存储器1000次擦写周期4.0-5.5V的工作电压范围全静态工作模式:0Hz-33MHz三级程序加密锁1288字节内部RAM32个可编程I/O口线2个16位定时/计数器6个中断源全双工串行UART通道低功耗空闲和掉电模式中断可从空闲模式唤醒系统看门狗(WDT)及双数据指针掉电标识和快速编程特性灵活的在线系统编程(ISP一字节或页写模式)功能特性概述:AT89S51提供以下标准功能:4k字节Fla

44、sh闪速存储器,128字节内部RAM, 32个I/O口线,看门狗(WDT),两个数据指针,两个16位定时/计数器,一个5向量两级中断结构,一个全双工串行通信口,片内振荡器及时钟电路。同时,AT89S51可降至0Hz的静态逻辑操作,并支持两种软件可选的节电工作模式。空闲方式停止CPU的工作,但允许RAM,定时/计数器,串行通信口及中断系统继续工作。掉电方式保存RAM中的内容,但振荡器停止工作并禁止其它所有部件工作直到下一个硬件复位。引脚功能说明:Vcc: 电源电压GND:地P0口:P0口是一组8位漏极开路型双向I/O口,也即地址/数据总线复用口。作为输出口用时,每位能驱动8个TTL逻辑门电路,对

45、端口写1可作为高阻抗输入端用。在访问外部数据存储器或程序存储器时,这组口线分时转换地址(低8位)和数据总线复用,在访问期间激活内部上拉电阻。在Flash编程时,P0 口接收指令字节,而在程序校验时,输出指令字节,校验时,要求外接上拉电阻。P1口:P1是一个带内部上拉电阻的8位双向I/O口,P1的输出缓冲级可驱动(吸收或输出电流)4个TTL逻辑门电路。对端口写1,通过内部的上拉电阻把端口拉到高电平,此时可作输入口。作输入口使用时,囚为内部存在上拉电阻,某个引脚被外部信号拉低时会输出一个电流(In)。Flash编程和程序校验期间 P 1接收低8位地址。P2口:P2是一个带有内部上拉电阻的8位双向I

46、/O口,P2的输出缓冲级可驱动(吸收或输出电流)4个TTL逻辑门电路。对端口写1,通过内部的上拉电阻把端口拉到高电平,此时可作输入口,作输入口使用时,囚为内部存在上拉电阻,某个引脚被外部信号拉低时会输出一个电流(In)。在访问外部程序存储器或16位地址的外部数据存储器(例如执行MOVX DPTR指令)时,P2口送出高 8位地址数据。在访问8位地址的外部数据存储器(如执行MOVX Ri指令)时,P2口线卜的内容(也即特殊功能寄存器(SFR)区中P2寄存器的内容),在整个访问期间不改变。Flash编程或校验时,P2亦接收高位地址和其它控制信号。P3口:P3口是一组带有内部上拉电阻的8位双向I/O口

47、。P3口输出缓冲级可驱动(吸收或输出电流)4个TTL逻辑门电路。对P3 口写入“1”时,它们被内部上拉电阻拉高并可作为输入端口。作输入端时,被外部拉低的P3 口将用上拉电阻输出电流(In)。 P3口除了作为一般的I/O口线外,更重要的用途是它的第二功能。P3 口还接收一些用于Flash闪速存储器编程和程序校验的控制信号。P3口也可作为AT89C51的一些特殊功能口,如下表所示:管脚备选功能P3.0 RXD(串行输入口)P3.1 TXD(串行输出口)P3.2 (外部中断0)P3.3 (外部中断1)P3.4 T0(记时器0外部输入)P3.5 T1(记时器1外部输入)P3.6 (外部数据存储器写选通

48、)P3.7 (外部数据存储器读选通)RST:复位输入。当振荡器工作时,RST引脚出现两个机器周期以上高电平将使单片机复位。WDT溢出将使该引脚输出高电平,设置SFR AUXR 的DISRTO位(地址8EH)可打开或关闭该功能。DISRTO位缺省为RESET输出高电平打开状态。ALE/PROG:当访问外部程序存储器或数据存储器时,ALE(地址锁存允许)输出脉冲用于锁存地址的低8位字节。即使不访问外部存储器,ALE仍以时钟振荡频率的1/6输出固定的正脉冲信号,囚此它可对外输出时钟或用于定时目的。要注意的是:每当访问外部数据存储器时将跳过一个ALE脉冲。对Flash存储器编程期间,该引脚还用于输入编程脉冲(PROG)。如有必要,可通过对特殊功能寄存器(SFR)区中的8EH单元的D0位置位,可禁正ALE操作。该位置位后,只有一条MOVX和MOVC指令ALE才会被激活。此外,该引脚会被微弱拉高,单片机执行外部程序时,应设置ALE无效。PSEN:程序储存允许(PSEN)输出是外部程序存储器的读选通信号,

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 教育专区 > 小学资料

本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知淘文阁网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

工信部备案号:黑ICP备15003705号© 2020-2023 www.taowenge.com 淘文阁