EasyManuals Logo

Intel MCS 51 User Manual

Intel MCS 51
334 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 #180 background imageLoading...
Page #180 background image
in~.
8XC51FXHARDWAREDESCRIPTION
Betting the DCEN bit enables Timer 2 to count up or
down as shown in Figure 14. In this mode the T2EX
pin controls the direction of count. A logic 1 at T2EX
makes Timer 2 count up. The timer will overtlow at
OFFFFH and set the TF2 bit which can then generate
an interruptifit is enabled. This overflow also causes a
the 16-bit vrduein RCAP2H end RCAP2L to be re-
loaded into the timer registers,TH2 and TL2, respec-
tively.
A logic Oat T2EX makes Timer 2 count down. Now
the timer undertows when TH2 and TL2 equal the
values stored in RCAP2H and RCAP2L. The under-
flow sets the TF2 bit and causesOFFFFH to be reload-
ed into the timer registers.
The EXF2 bit toggles wheneverTimer 2 overflows or
underflows. This bit can be usedes a 17th bit of resolu-
tion if desired. In this operatingmodq EXF2 does not
generateen interrupt.
BAUD RATE GENERATOR MODE
The baud rate generatormode is selected by setting the
RCLK end/or TCLK bits in T2CON. Timer 2 in this
mode will be described in conjunction with the serial
port.
PROGRAMMABLE CLOCK OUT
A 50% duty cycle clock can be programmed to come
out on P1.O.This pin, besides being a regular 1/0 pin,
has two alternatefunctions. It can be programmed(1)
to input the external clock for Timer/Counter 2 or (2)
to output a
so~o duty cycle clock ranging from 61 Hz
to 4 MHz at a 16 MHz operatingfrequency.
To configurethe Timer/Counter 2 as a clock generator,
bit Cf12 (in T2CON) must be clearedend bit T20E in
T2MOD must be set. Bit TR2 (T2CON.2) also must be
set to startthe timer (see Table 6 for operatingmodes).
The Clock-out frequency dependson the oscillator fre-
quency and the reload value of Timer 2 capture regis-
ters (RCAP2H, RCAP2L) es shown in this equation:
Clock-outFrequency=
OscillatorFrequency
4 X (65536 - RCAP2H,RCAP2L)
In the Clock-Out mode Timer 2 redl-overswill not gen-
erate errinterrupt. This is similar to when Timer 2 is
used as a baud-rategenerator.It is possible to use Tim-
er 2 as a baud-rate generator and a clock generator
simultaneously. Note, however,that the baud-rate end
Clock-out frequencies cannot be determined indepen-
dently of one snother since they both use the values in
RCAP2H and RCAP2L.
6.0 PROGRAMMABLE COUNTER
ARRAY
The Pw=-ble count~ AITSYfJ’W e-ists of a
16-bit timer/camter end five 16-bit compare/cepture
modules es shown in Figure 15a.The PCA timer/cmur-
ter serves as a common time base for the five modulea
end is the only timer which can service the PCA. Its
clock input cartbe prograrnm
ed to count any one of the
following signals:
oscillator frequency + 12
oscillator frequency + 4
Timer OOVdOW
external input on ECI (P1.2).
Each compere/cspture mcdule can be programmedin
any one of the following modes:
. rising rind/or falling edge capture
softwere timer
high speed output
. pulse width modulator.
Module 4 can also be programmedas a watchdog tim-
er.
When the compere/cspture modules are programmed
in the capture mod%softwaretimer,or high speed out-
put mode, an interrupt can be generated when the med-
uleexecutesitsfunction.AllfivemodulesplusthePCA
timer overtlow share one interrupt vector (more about
this
in the PCA Interrupt section).
5-18

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Intel MCS 51 and is the answer not in the manual?

Intel MCS 51 Specifications

General IconGeneral
BrandIntel
ModelMCS 51
CategoryMicrocontrollers
LanguageEnglish

Related product manuals