机械专业外文文献翻译外文翻译AT89C52单片机.doc
《机械专业外文文献翻译外文翻译AT89C52单片机.doc》由会员分享,可在线阅读,更多相关《机械专业外文文献翻译外文翻译AT89C52单片机.doc(13页珍藏版)》请在三一文库上搜索。
1、The AT89C52 is a low-power, high-performance CMOS 8-bit microcomputer with 8 Kbytesof Flash programmable and erasable read only memory (PEROM). The device is manufac-tured using Atmels high density nonvolatile memory technology and is compatible with theindustry standard 80C51 and 80C52 instruction
2、set and pinout. The on-chip Flash allows theprogram memory to be reprogrammed in-system or by a conventional nonvolatile memoryprogrammer. By combining a versatile 8-bit CPU with Flash on a monolithic chip, the AtmelAT89C52 is a powerful microcomputer which provides a highly flexible and cost effect
3、ivesolution to many embedded control applications.The AT89C52 provides the following standard features: 8 Kbytes of Flash, 256 bytes ofRAM, 32 I/O lines, three 16-bit timer/counters, a six-vector two-level interrupt architecture, afull duplex serial port, on-chip oscillator, and clock circuitry. In
4、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/count-ers, serial port, and interrupt system to continue functioning. The Power Down Mode saves
5、the RAM contents but freezes the oscillator, disabling all other chip functions until the next hard-ware reset. A 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 i
6、mplemented on the chip. Read accesses to these addresses will in general return random data, and write accesses will have an indeterminate effect.User software should not write 1s to these unlisted locations, since they may be used in future products to invoke new fea-tures. In that case, the reset
7、or inactive values of the new bits willalways be 0. Control and status bits are contained in reg-isters T2CON and T2MOD 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.The individual interrupt enable bits
8、are in the IE register. Two priorities can be set for each of the six inter-rupt sources in the IP register.The AT89C52 implements 256 bytes of on-chip RAM. The up-per 128 bytes occupy a parallel address space to the Special Function Registers. That means the upper 128 bytes have the same addresses
9、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
10、 space.For example, the following direct addressing instruction ac-cesses the SFR at location 0A0H (which is P2).MOV 0A0H, #dataInstructions that use indirect addressing access the upper 128 bytes of RAM. For example, the following indirect addressing instruction, where R0 contains 0A0H, accesses th
11、e data byte at address 0A0H, rather than P2 (whose address is 0A0H).MOV R0, #dataNote 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
12、 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 is selected by bit C/T2 in the SFR T2CON (shown in Table 2). Timer 2 has three operating modes: capture, auto-reload (up or down count-ing), and baud rate generator.
13、 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.
14、In the Counter function, the register is incremented in response to a l-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 cy-cle and a low in the next cycle, the count i
15、s 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 recog-nize a 1-to-0 transition, the maximum count rate is 1/24 of the oscillator frequency. To
16、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 T
17、2CON. This bit can then be used to generate an interrupt. If EXEN2 = 1, Timer 2 per-forms the same operation, but a l-to-0 transition at external input T2EX also causes the current value in TH2 and TL2 to be cap-tured into RCAP2H and RCAP2L, respectively. In addition, the transition at T2EX causes b
18、it 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 config-ured in its 16-bit auto-reload mode. This feature is invoked by the DCEN (Down Counter
19、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
20、 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 RCAP2H and RCAP2L are preset by software. If EXEN2 = 1
21、 a 16-bit reload can be triggered either by an overflow or by a l-to-0 transition at exter-nal 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 enables Timer 2 to count up or down, as shown in Figure 3. In this
22、mode, the T2EX pin controls the di-rection 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 T2E
23、X makes Timer 2 count down. The timer under-flows 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 under-flows and can be used as a 17th bit of re
24、solution. In this operat-ing 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 a
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 机械 专业 外文 文献 翻译 AT89C52 单片机
