EasyManua.ls Logo

Atmel AT89C52 User Manual

Atmel AT89C52
22 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #7 background imageLoading...
Page #7 background image
OSC
EXF2
TF2
T2EX PIN
T2 PIN
TR2
EXEN2
C/T2 = 0
C/T2 = 1
CONTROL
RELOAD
OVERFLOW
CONTROL
TRANSITION
DETECTOR
TIMER 2
INTERRUPT
÷12
RCAP2LRCAP2H
TH2 TL2
Figure 2. Timer 2 Auto Reload Mode (DCEN = 0)
Table 4. T2MOD—Timer 2 Mode Control Register
T2MOD Address = 0C9H Reset Value = XXXX XX00B
Not Bit Addressable
——————T2OEDCEN
Bit76543210
Symbol Function
Not implemented, reserved for future use.
T2OE Timer 2 Output Enable bit.
DCEN When set, this bit allows Timer 2 to be configured as an up/down counter.
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, a 16-bit reload can be triggered either by an
overflow or by a l-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 enables Timer 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 regis-
ters, 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 regis-
ters.
The EXF2 bit toggles whenever Timer 2 overflows or un-
derflows and can be used as a 17th bit of resolution. In this
operating mode, EXF2 does not flag an interrupt.
Auto-Reload (Up or Down Counter) (Continued)
AT89C52
7
Question and Answer IconNeed help?

Do you have a question about the Atmel AT89C52 and is the answer not in the manual?

Atmel AT89C52 Specifications

General IconGeneral
Architecture8-bit
ManufacturerAtmel
Core8051
Program Memory Size8 KB
RAM Size256 Bytes
Number of I/O Pins32
UARTYes
PackagePDIP, PLCC, TQFP
Data Bus Width8-bit
Address Bus Width16-bit
Interrupts6
Operating Voltage4.0V - 5.5V
Clock Speed24 MHz

Summary

Description

Block Diagram

Pin Description

Vcc

Supply voltage for the microcontroller.

GND

Ground connection for the microcontroller.

Port 0

8-bit open-drain bidirectional I/O port with multiple functions.

Port 1

8-bit bidirectional I/O port with internal pullups and special functions.

Port 2

8-bit bidirectional I/O port with internal pullups, used for address bus.

Port 3

8-bit bidirectional I/O port with internal pullups and special function pins.

RST

Reset input pin; high for two machine cycles resets the device.

ALE/PROG

Address Latch Enable/Program Pulse input.

EA/VPP

External Access Enable / Programming Voltage input.

XTAL1

Input for oscillator amplifier and clock circuitry.

XTAL2

Output from the inverting oscillator amplifier.

Special Function Registers

Timer 0 and 1

Timer 2

Capture Mode

Two options selected by EXEN2 for capture or overflow interrupts.

Auto-Reload (Up or Down Counter)

Timer 2 counts up/down, reloads from RCAP2H/RCAP2L.

Baud Rate Generator

Timer 2 configured to generate baud rates for serial communication.

Programmable Clock Out

Using Timer 2 to generate a 50% duty cycle clock output.

UART

Interrupts

IE register

Special Function Register for enabling/disabling interrupts.

Interrupt Sources

Description of external and timer interrupts.

Oscillator Characteristics

Idle Mode

Power Down Mode

Program Memory Lock Bits

Programming the Flash

Data Polling

Indicates end of write cycle by complement of written data on PO.7.

Ready/Busy

P3.4 indicates BUSY or READY status during programming.

Program Verify

Reads back programmed code for verification if lock bits are not set.

Absolute Maximum Ratings

D.C. Characteristics

A.C. Characteristics

Ordering Information

Related product manuals