Datasheet AT89S53 (Microchip) - 10

ManufacturerMicrochip
Description8-bit Microcontroller with 12K Bytes Flash
Pages / Page35 / 10 — Capture Mode. Figure 1. Auto-reload (Up or Down Counter). AT89S53
File Format / SizePDF / 892 Kb
Document LanguageEnglish

Capture Mode. Figure 1. Auto-reload (Up or Down Counter). AT89S53

Capture Mode Figure 1 Auto-reload (Up or Down Counter) AT89S53

Model Line for this Datasheet

Text Version of Document

link to page 10 link to page 11 link to page 12 link to page 11
Capture Mode
In the capture mode, two options are selected by bit current value in TH2 and TL2 to be captured into RCAP2H EXEN2 in T2CON. If EXEN2 = 0, Timer 2 is a 16-bit timer and RCAP2L, respectively. In addition, the transition at or counter which upon overflow sets bit TF2 in T2CON. T2EX causes bit EXF2 in T2CON to be set. The EXF2 bit, This bit can then be used to generate an interrupt. If like TF2, can generate an interrupt. The capture mode is EXEN2 = 1, Timer 2 performs the same operation, but a l- illustrated in Figure 1. to-0 transition at external input T2EX also causes the
Figure 1.
Timer 2 in Capture Mode OSC ÷12 C/T2 = 0 TH2 TL2 TF2 OVERFLOW CONTROL TR2 C/T2 = 1 T2 PIN CAPTURE RCAP2H RCAP2L TRANSITION DETECTOR TIMER 2 INTERRUPT T2EX PIN EXF2 CONTROL EXEN2
Auto-reload (Up or Down Counter)
Timer 2 can be programmed to count up or down when count up. The timer will overflow at 0FFFFH and set the configured in its 16-bit auto-reload mode. This feature is TF2 bit. This overflow also causes the 16-bit value in invoked by the DCEN (Down Counter Enable) bit located in RCAP2H and RCAP2L to be reloaded into the timer regis- the SFR T2MOD (see Table 9). Upon reset, the DCEN bit ters, TH2 and TL2, respectively. is set to 0 so that timer 2 will default to count up. When A logic 0 at T2EX makes Timer 2 count down. The timer DCEN is set, Timer 2 can count up or down, depending on underflows when TH2 and TL2 equal the values stored in the value of the T2EX pin. RCAP2H and RCAP2L. The underflow sets the TF2 bit and Figure 2 shows Timer 2 automatically counting up when causes 0FFFFH to be reloaded into the timer registers. DCEN = 0. In this mode, two options are selected by bit The EXF2 bit toggles whenever Timer 2 overflows or EXEN2 in T2CON. If EXEN2 = 0, Timer 2 counts up to underflows and can be used as a 17th bit of resolution. In 0FFFFH and then sets the TF2 bit upon overflow. The over- this operating mode, EXF2 does not flag an interrupt. flow 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 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 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
10 AT89S53
0787E–MICRO–3/06 Document Outline Block Diagram Instruction Set Features Description Pin Description VCC GND Port 0 Port 1 Pin Description Port 2 Port 3 RST ALE/PROG PSEN EA/VPP XTAL1 XTAL2 Special Function Registers Data Memory - RAM Programmable Watchdog Timer Timer 0 and 1 Timer 2 Capture Mode Auto-reload (Up or Down Counter) Baud Rate Generator Programmable Clock Out UART Serial Peripheral Interface Interrupts Oscillator Characteristics Idle Mode Status of External Pins During Idle and Power-down Modes Power-down Mode Program Memory Lock Bits Lock Bit Protection Modes(1)(2) Programming the Flash Programming Interface Serial Downloading Either an external system clock is supplied at pin XTAL1 or a crystal needs to be connected across pins XTAL1 and XTAL2. The max... Serial Programming Algorithm Serial Programming Instruction Flash Parallel Programming Modes Flash Programming and Verification Characteristics - Parallel Mode Flash Programming and Verification Waveforms - Parallel Mode Serial Downloading Waveforms Absolute Maximum Ratings* DC Characteristics AC Characteristics External Program and Data Memory Characteristics External Program Memory Read Cycle External Data Memory Read Cycle External Data Memory Write Cycle External Clock Drive Waveforms External Clock Drive Serial Port Timing: Shift Register Mode Test Conditions Shift Register Mode Timing Waveforms AC Testing Input/Output Waveforms(1) Float Waveforms(1) Ordering Information Pin Configurations