I/O SYMBOLPINPINPINDESCRIPTION
I/O P0.0-P0.739-3243-3637-30Port:8-bit open drain bidirectional I/O Port
I/O P2.0-P2.721-2824-3118-25Port: 8-bit quasi-bidirectional I/O Port with internal pull-up
I/O P1.0-P1.71-82-940-44,1-3Port: 8-bit quasi-bidirectional I/O Port with internal pull-up
, except P1.6 and P1.7
I/O P3.0-P3.710-1711,13-195,7-13Port: 8-bit quasi-bidirectional I/O Port with internal pull-up
I/O P4.0~P4.3/NA23,34,1,12 17,28,39,64bit Quasi-bidirectional I/O port or PWM PWM0~PWM3
IRESET9104reset input
IVCC404438Positive power supply
IVSS202216Ground
IXTAL1192115XTAL connection input
OXTAL2182014XTAL connection output
OPSEN293226Program store enable output
OALE303327Address latch enable output
IEA313529External access input
P/N:PM0887
Specifications subject to change without notice, contact your sales representatives for the most update information.
3
REV. 1.6, MAR. 28, 2005
PRELIMINARY
MX10E8050I /
MX10E8050IA
MnemonicPin NumberTypeName and Function
PDIPPLCCLQFP
V
ss
V
cc
P0.0 ~ 0.739-3243-3637-30I/OPort 0: Port 0 is an open drain, bi-directional I/O port. Port 0
P1.0~1.71-82-940-44I/OPort1: Port 1 is an 8-bit bi-directional I/O port with internal
P2.0~2.721-2824-3118-25I/OPort 2 : Port 2 is an 8-bit bi-directional I/O port with internal
P3.0~3.710-1711,5,I/OPort 3: Port 3 is an 8-bit bi-directional I/O port with internal
202216IGround: 0 volt reference
404438IPower Supply: This is the power supply voltage for normal,
idle and power-down operation
pins have 1s written to them float and can be used as high
impedance inputs. Port 0 is also the multiplexed low-order
address and data bus during accessed to external program
and data memory. In this application, it uses strong internal
pull-ups when emitting 1s.
1-3pull-ups. Port 1 pins that have 1s written to them are pulled
high by the internal pull-ups and can be used as inputs. As
inputs, Port 1 pins that are externally pulled low will source
current because of the internal pull-ups. Note that P1.6 and
P1.7 are open drain pins for I2C function.
Alternate functions for port 1 include:
1240I/OT2(P1.0): Timer/Counter 2 external count input/clock out
2341IT2EX(P1.1): Timer/Counter 2 Reload / Capture / Direction
control
3442ISDA (P1.7): Data line for I2C
4543I/OSCL (P1.6): Clock line for I2C
5644I/O
671I/O
782I/O
893I/O
pull-ups. Port2 pins that have 1s written to them are pulled
high by the internal pull-ups and can be used as inputs. As
inputs, Port 2 pins that are externally pulled low will source
current because of the internal pull-ups. Port 2 emits the high
ordered address byte during fetches from external program
memory and during accesses to external data memory that
use 16-bit addresses (MOVX @DPTR). In this application, it
uses strong internal pull-ups when emitting 1s. During
accesses to external data memory using 8-bit addresses
(MOVX@RI), port 2 emits the contents of P2 special
`function register.
P/N:PM0887
Specifications subject to change without notice, contact your sales representatives for the most update information.
4
REV. 1.6, MAR. 28, 2005
PRELIMINARY
MX10E8050I /
MX10E8050IA
13-197-13pull-ups. Port 3 pins that have 1s written to them are pulled
high with the internal pull-ups and can be used as inputs. As
inputs, Port 3 pins that are externally pulled low will source
current because of the internal pull-ups. Port 3 also serves
the special features of MX10E8050I family, as listed below:
10115I RxD (P3.0) : Serial input port
11137O TxD (P3.1) : Serial output port
12148I INT0 (P3.2) : External interrupt 0
13159I INT1 (P3.3) : External interrupt 1
141610I T0 (P3.4) : Timer 0 external input
151711I T1 (P3.5) : Timer 1 external input
161812O WR (P3.6) : External data memory write strobe
171914O RD (P3.7) : External data memory read strobe
P4.0~P4.3I/OPort 4: Port 4 is an 4-bit bi-directional I/O port with internal
pull-ups. Port 4 pins that have 1s written to them are pulled
high with the internal pull-ups and can be used as inputs. As
inputs, Port 4 pins that are externally pulled low will source
current because of the internal pull-ups. Port 4 also serves
the special features of MX10E8050I family, as listed below:
P4.02317I PWM0 (P4.0) : PWM module output 0
P4.13428I PWM1 (P4.1) : PWM module output 1
P4.2139I PWM2 (P4.2) : PWM module output 2
P4.3126I PWM3 (P4.3) : PWM module output 3
RST9104IReset : A high on this pin for eight machine cycles while the
oscillator is running, reset the devices.
ALE303327OAddress Latch Enable: Output pulse for latching the low byte
of the address during an access to external memory. In
normal operation, ALE is emitted at constant rate of 1/6 the
oscillator frequency in 12x clock mode. 1/3 the oscillator
frequency in 6x clock mode, and can be used for external
timing or clocking. Note that one ALE pulse is skipped during
each access to external data memory.
PSEN293226OProgram Strobe Enable: The read strobe to external program
memory. When executing code from external program
memory, PSEN is activated twice each machine cycle.,
except the two PSEN activation are skipped during each
access to external data memory. PSEN is not activated
during fetch from internal program memory.
EA313515IExternal Access Enable/ Programming Supply Voltage: EA
must be external held low to enable the device to fetch code
from external program memory locations 0000H and FFFFH
for 64 K devices.
XTAL 1192115ICrystal 1: Input to the inverting oscillator amplifier and input
to the internal clock generator circuits.
XTAL 2182014OCrystal 2: Output from the inverting oscillator amplifier.
P/N:PM0887
Specifications subject to change without notice, contact your sales representatives for the most update information.
5
REV. 1.6, MAR. 28, 2005
BLOCK DIAGRAM
Vcc
Vss
PORT 4
DRIVERS
PORT 4
LATCH
P0.0-P0.7P4.0-P4.3P2.0-P2.7
PORT 0
DRIVERS
PORT 2
DRIVERS
PRELIMINARY
MX10E8050I /
MX10E8050IA
PSEN
ALE
EA
RST
TIMING
AND
CONTROL
REGISTER
RAM ADDR.
B
REGISTER
INSTRUCTION
RAMPWM
ACC
TMP2
REGISTER
PSW
PORT 1
LATCH
ALU
PORT 0
LATCH
TMP1
STACK
POINTER
T0/T1/T2
SFRs
TIMERS
I2C
PORT 2
LATCH
T3
WATCHDOG
TIMER
ROM
PROGRAM
ADDR.
REGISTER
BUFFER
PC
INCREMENTER
PROGRAM
COUNTER
DPTR
PORT 3
LATCH
P/N:PM0887
OSC.
XTAL1
Specifications subject to change without notice, contact your sales representatives for the most update information.
XTAL2
PORT 1
DRIVERS
P1.0-P1.7
Input Filter
Output Stage
PORT 3
DRIVERS
P3.0-P3.7
6
REV. 1.6, MAR. 28, 2005
PRELIMINARY
MX10E8050I /
MX10E8050IA
FUNCTIONAL DESCRIPTION
General
The MX10E8050I Serial is a stand-alone high-performance and low power microcontroller designed for use in many
applications which need code programmability.
The Flash EPROM offers customers to program the device themselves. This feature increases the flexibility in
many applications, not only in development stage, but also in mass production stage.
In addition to the 80C51 standard functions, the MX10E8050I Serial provides a number of dedicated hardware
functions. MX10E8050I Serial is a control-oriented CPU with on-chip program and data memory. It can execute
program with internal memory up to 64k bytes. MX10E8050I Serial has two software selectable modes of reduced
activity for power reduction Idle, and Power-down. The idle mode freezes the CPU while allowing the RAM, Timers,
serial ports, interrupt system and other peripherals to continue functioning. The Power-down mode saves the RAM
contents but freezes the oscillator causing all other chip functions to be inoperative. Power-down mode can be
terminated by an external reset ,and in addition , by either of the two external interrupts can be terminated as the
power down mode does.
MEMORY ORGANIZATION
The Central Processing Unit (CPU) manipulates operands in three memory spaces; these are the 256 bytes
internal data memory (RAM), 1k byte auxiliary data memory (AUX-RAM) and 64k byte internal MTP program memory
( FLASH ROM ).
Program Memory
The program memory address space of the MX10E8050I Serial comprises an internal and an external memory
space. The MX10E8050I Serial has 64k byte of program memory on-chip.
Program Protection
If the user choose to set security lock in MTP memory, the program content is protected from reading out of chip.
Internal Data Memory
The internal data memory is divided into three physically separated parts: 256 byte of RAM, 1k bytes of AUX-RAM,
and 128 bytes special function register area (SFR). These parts can be addressed as follows (see Fig.1 and Table. 2)
- RAM 0 to 127 can be addressed directly and indirectly as in the 80C51. Address pointers are R0 and R1 of
the selected register bank.
- RAM 128 to 255 can only be addressed indirectly . Address pointers are R0 and R1 of the selected register
bank.
- AUX-RAM 0 to 1023 is indirectly addressable as the external data memory locations 0 to 1023 by the
MOVX instructions. Address pointers are R0 and R1 of the selected register bank and DPTR. SFRs can only
be addressed directly in the address range from 128 to 255.
P/N:PM0887
Specifications subject to change without notice, contact your sales representatives for the most update information.
7
REV. 1.6, MAR. 28, 2005
PRELIMINARY
MX10E8050I /
MX10E8050IA
Table. 2 Internal data memory access
LOCATIONADDRESSED
RAM 0 to 127DIRECT and INDIRECT
RAM 128 to 255INDIRECT only
AUX-RAM 0 to 1023INDIRECT only with MOVX
Special Function Register (SFR) 128 to 255DIRECT only
Fig. 1 shows the internal memory address space. Table 3 shows the Special Function Register (SFR) memory
map. Location 0 to 31 at the lower RAM area can be devided into four 8-bit register banks. Only one of these
banks may be enabled at a time. The next 16 bytes, locations 32 through 47, contain 128 directly addressable bit
locations.
The stack can be located anywhere in the internal 256 byte RAM. The stack depth is only limited by the available
internal RAM space of 256 bytes. All registers except the Program Counter and the four 8-byte register banks
reside in the SFR address space.
Five methods to access memory space are as floww :
- Register
- Direct
- Register-Indirect
- Immediate
- Base-Register plus Index-Register-Indirect.
The first three methods can be used for addressing destination operands. Most instructions have a 'destination /
source' field that specifies the data type, addressing methods and operands involved. For operations other than
MOVs, the destination operand is also a source operand.
Access to memory addresses is as follows:
- Register in one of the four 8-byte register banks through Direct or Register-Indirect addressing.
- 256 bytes of internal RAM through Direct or Register-Indirect addressing. Bytes 0-127 of internal RAM may be
only be addressed indirectly as data RAM.
- SFR through direct addressing at address location 128-255.
OVERLAPPED SPACE with different access schemes
64k
FLASH memory
INTERNAL PROGRAM MEMORY
255
127
0
Indirect
Only
Direct and
Indirect
MAIN RAMSFRsAUX-RAM
SFRs
direct only
INTERNAL DATA MEMORY
AUXILIARY
RAM
through
MOVX access
1023
0
Fig.1 Internal program and data memory address space
P/N:PM0887
Specifications subject to change without notice, contact your sales representatives for the most update information.
Specifications subject to change without notice, contact your sales representatives for the most update information.
11
REV. 1.6, MAR. 28, 2005
PRELIMINARY
MX10E8050I /
MX10E8050IA
AUXR (8EH)
EXTRAMA0
- EXTRAM : External RAM Select Switch. Set 1 to select (MOVX) the external RAM directly.
Default is 0 to switch (MOVX) to external RAM only when the address is larger than 1k.
- AO : Turn off ALE output in internal execution mode.
( 1 : Turn off )
( 0 : Turn on )
Watchdog Timer/WDT/T3 (FFH)
- WDT consists of an 11-bit prescaler and an 8-bit timer formed by SFR T3.
EBTCON (EBH)
/EW
- /EW: After reset, /EW bit is set, and WDT is disable.
POWER CONTROL Register/PCON (87H)
SMOD1 SMOD0 XWLE GF1GF0 PD IDL
- SMOD1: Double baud rate bit for UART.
- SMOD0: Frame error detection bit.
- WLE: Watchdog load enable. This flag must be set prior to loading WDT and is cleared when WDT is loaded.
- GF1/GF0: general-purpose flag bit.
- PD: Power-down bit. Setting it activates power-down mode.
- IDL: Idle mode bit. Setting it activates idle mode.
- The CPU & Peripheral status during 2 power saving mode:
Specifications subject to change without notice, contact your sales representatives for the most update information.
12
REV. 1.6, MAR. 28, 2005
PRELIMINARY
MX10E8050I /
MX10E8050IA
I/O facilities
MX10E8050I serial has one 8 bits port, port 0, which is open drain, three 8 bits ports, port1/2/3 and a four-bits port
port 4 . They are quasi bi-directional ports except P1.6 and P1.7. These five ports are fully compatible to standard
80C51's port 0/1/2/3/4.
- Port3: pins can be configured individually to provide: external interrupt inputs (external interrupt 0/1);
external inputs for Timer/ counter 0 and Timer /counter1, and UART receive / transmit.
- Port 1.6, Port 1.7 : pins are used to be I2C clock and data I/O, which are open drain
Port pins which are not used for alternate functions may be used as normal bidirectional I/O pins. The generation or
use of a Port 1 or Port 3 pin as an alternate function is carried out automatically by writing the associated SFR bit with
proper value.
+3V
from port latch
input data
read port pin
2 oscillator
penods
O
INPUT
BUFFER
strong pull-up
P1
n
P2
P3
I/O PORT
1,2,3,4
exclude P1.6,P1.7
I/O buffers in the MX10E8050I (Ports 1,2,3,4)
P/N:PM0887
Specifications subject to change without notice, contact your sales representatives for the most update information.
13
REV. 1.6, MAR. 28, 2005
PRELIMINARY
MX10E8050I /
MX10E8050IA
Timer/Counter
MX10E8050I Serial Timer/Counter 0 and 1 are fully compatible to standard 80C51's.
The MX10E8050I Serial contains two 16-bit Timer/counters, Timer 0 and Timer 1. Timer 0 and Timer 1 may be
programmed to carry out the following functions:
- measure time intervals and pulse durations
- count events
- generate interrupt requests.
Timer 0 and Timer 1
Timers 0 and 1 each have a control bit in TMOD SFR that selects the Timer or counter function of the
corresponding Timer. In the Timer function, the register is incremented every machine cycle. Thus, one can think of
it as counting machine cycles. Since a machine cycle consists of 12 oscillator periods, the count rate is 1/12 of
the oscillator frequency.
In the counter function, the register is incremented in response to a HIGH-to-LOW transition at the corresponding
samples, when the transition shows a HIGH in one cycle and a LOW in the next cycle, the counter is incremented.
Thus, it takes two machine cycles (24 oscillator periods) to recognize a HIGH-to-LOW transition. There are no
restrictions on the duty cycle of the external input signal, but to ensure that a given level is sampled at least once
before it changes, it should be held for at least one full machine cycle.
Timer 0 and Timer 1 can be programmed independently to operate in one of four modes (refer to table 5) :
- Mode 0 : 8-bit Timer/counter with devided-by-32 prescaler
- Mode 1 : 16-bit Timer/counter
- Mode 2 : 8-bit Timer/counter with automatic reload
- Mode 3 : Timer 0 :one 8-bit Timer/counter and one 8-bits Timer. Timer 1 :stopped.
When Timer 0 is in Mode 3, Timer 1 can be programmed to operate in Modes 0, 1 or 2 but cannot set an interrupt
request flag and generate an interrupt. However, the overflow from Timer 1 can be used to pulse the Serial Port
transmission-rgate generator. With a 16 MHz crystal, the counting frequency of these Timer/counters is as follows:
- in the Timer function, the Timer is incremented at a frequency of 1.33 MHz (oscillator frequency divided by 12).
- in the counter function, the frequency handling range for external inputs is 0 Hz to 0.66 MHz (oscillator
frequency divided by 24).
Both internal and external inputs can be gated to the Timer by a second external source for directly measuring
pulse duration.
The Timers are started and stopped under software control. Each one sets its interrupt request flag when it
overflows from all logic 1's to all logic 0's (respectively, the automatic reload value), with the exception of Mode 3
as previously described.
TMOD : TIMER/COUNTER MODE CONTROL REGISTER
This register is located at address 89H.
Specifications subject to change without notice, contact your sales representatives for the most update information.
REV. 1.6, MAR. 28, 2005
14
PRELIMINARY
MX10E8050I /
MX10E8050IA
Table. 5 Description of TMOD bits
MNEMONICPOSITIONFUNCTION
TIMER 1
GATETMOD.7Timer 1 gating control : when set, Timer/counter '1' is enabled only while 'Int1'
pin is high and 'tr1' control bit is set. when cleared, Timer/counter '1' is enabled
whenever 'tr1' control bit is set.
C/TTMOD.6Timer or counter selector: cleared for Timer operation (input from internal
system clock). set for counter operation (input from 'T1' input pin).
M1TMOD.5Operation mode: see table 6.
M0TMOD.4Operation mode: see table 6.
TIMER 0
GATETMOD.3Timer 0 gating control: when set, Timer/Counter '0' is enabled only while 'Int0'
pin is high and 'tr0' control bit is set. when cleared, Timer/counter '0' is enabled
whenever 'tr0' control bit is set.
C/TTMOD.2Timer or counter selector: cleared for Timer operation (input from internal
system clock). set for counter operation (input from 'T0' input pin).
M1TMOD.1Operation mode: see table 6.
M0TMOD.0Operation mode: see table 6.
Table. 6 TMOD M1 and M0 operating modes
M1M0FUNCTION
008-bit Timer/counter : 'THx' with 5-bit prescaler.
0116-bit Timer/counter : 'THx' and 'TLx' are cascaded, there is no prescaler.
108-bit autoload Timer/counter : 'THx' holds a value which is to be reloaded into 'TLx' each time it
overflows.
11Timer 0: TL0 is an 8-bit Timer/counter controlled by the standard Timer 0 control bits. TH0 is an 8-
bit Timer controlled by Timer 1 control bits.
11Timer 1 : Timer/counter 1 stopped.
TCON : TIMER/COUNTER CONTROL REGISTER
This register is located at address 88H.
Notes :
Symbol DescriptionDirectBit Address, Symbol, or Alternative Port FunctionReset
AddressMSB LSBFunction
TMODTimer Mode89HGATE C/TM1M0GATE C/TM1M000H
P/N:PM0887
Specifications subject to change without notice, contact your sales representatives for the most update information.
15
REV. 1.6, MAR. 28, 2005
PRELIMINARY
MX10E8050I /
MX10E8050IA
Table. 7 TCON SFR (88H)
76543210
TF1TR1TF0TR0IE1IT1IE0IT0
(MSB)(LSB)
keep the above table with the following table
Table. 8 Description of TCON bits
MNEMONICPOSITIONFUNCTION
TF1TCON.7Timer 1 overflow flag : set by hardware on Timer/Counter overflow. Cleared when
interrupt is processed.
TR1TCON.6Timer 1 control bit : set/cleared by software to turn Timer/counter ON/OFF.
TF0TCON.5Timer 0 overflow flag: set by hardware on Timer/Counter overflow. Cleared when
interrupt is processed.
TR0TCON.4Timer 0 control bit : set/cleared by software to turn Timer/counter ON/OFF.
IE1TCON.3Interrupt 1 edge flag: set by hardware when external interrupt is detected. Cleared
when interrupt is processed.
IT1TCON.2Interrupt 1 type control bit : set/cleared by software to specify falling edge/LOW
level triggered external interrupt.
IE0TOCN.1Interrupt 0 edge flag: set by hardware when external interrupt is detected. Cleared
when interrupt is processed.
IT0TOCN.0Interrupt 0 type control bit: set/cleared by software tospecify falling edge/LOW
level triggered external interrupt.
P/N:PM0887
Specifications subject to change without notice, contact your sales representatives for the most update information.
16
REV. 1.6, MAR. 28, 2005
PRELIMINARY
MX10E8050I /
MX10E8050IA
TIMER 2 OPERATION
Timer 2
Timer 2 is a 16-bit Timer/Counter which can operate as either an event timer or an event counter, as selected by C/
T2* in the special function register T2CON (see Figure 2). Timer 2 has three operating modes: Capture, Auto-reload
(up or down counting), and Baud Rate Generator, which are selected by bits in the T2CON as shown in Table 9.
Capture Mode
In the capture mode there are two options which are selected by bit EXEN2 in T2CON. If EXEN2=0, then timer 2 is a
16-bit timer or counter (as selected by C/T2* in T2CON) which, upon overflowing sets bit TF2, the timer 2 overflow bit.
This bit can be used to generate an interrupt (by enabling the Timer 2 interrupt bit in the IE register). If EXEN2= 1,
Timer 2 operates as described above, but with the added feature that a 1- to -0 transition at external input T2EX
causes the current value in the Timer 2 registers, TL2 and TH2, to be captured into registers RCAP2L and RCAP2H,
respectively. In addition, the transition at T2EX causes bit EXF2 in T2CON to be set, and EXF2 like TF2 can generate
an interrupt (which vectors to the same location as Timer 2 overflow interrupt. The Timer 2 interrupt service routine can
interrogate TF2 and EXF2 to determine which event caused the interrupt). The capture mode is illustrated in Figure B
(There is no reload value for TL2 and TH2 in this mode. Even when a capture event occurs from T2EX, the counter
keeps on counting T2EX pin transitions or osc/6 pulses (osc/12 in 12 clock mode).).
Auto-Reload Mode ( Up or Down Counter )
In the 16-bit auto-reload mode, Timer 2 can be configured (as either a timer or counter [C/T2* in T2CON]) then
programmed to count up or down. The counting direction is determined by bit DCEN (Down Counter Enable) which is
located in the T2MOD register (see Figure 4). When reset is applied the DCEN=0 which means Timer 2 will default to
counting up. If DCEN bit is set, Timer 2 can count up or down depending on the value of the T2EX pin.
Figure 5 shows Timer 2 which will count up automatically since DCEN=0. In this mode there are two options selected
by bit EXEN2 in T2CON register. If EXEN2=0, then Timer 2 counts up to 0FFFFH and sets the TF2 (Overflow Flag) bit
upon overflow. This causes the Timer 2 registers to be reloaded with the 16-bit value in RCAP2L and RCAP2H. The
values in RCAP2L and RCAP2H are preset by software means.
If EXEN2=1, then a 16-bit reload can be triggered either by an overflow or by a 1-to-0 transition at input T2EX. This
transition also sets the EXF2 bit. The Timer 2 interrupt, if enabled, can be generated when either TF2 or EXF2 are 1.
In Figure 6 DCEN=1 which enables Timer 2 to count up or down. This mode allows pin T2EX to control the direction
of count. When a logic 1 is applied at pin T2EX Timer 2 will count up. Timer 2 will overflow at 0FFFFH and set the TF2
flag, which can then generate an interrupt, if the interrupt is enabled. This timer overflow also causes the 16-bit value
in RCAP2L and RCAP2H to be reloaded into the timer registers TL2 and TH2.
When a logic 0 is applied at pin T2EX this causes Timer 2 to count down. The timer will underflow when TL2 and TH2
become equal to the value stored in RCAP2L and RCAP2H. Timer 2 underflow sets the TF2 flag and causes 0FFFFH
to be reloaded into the timer registers TL2 and TH2.
The external flag EXF2 toggles when Timer 2 underflows or overflows. This EXF2 bit can be used as a 17th bit of
resolution if needed. The EXF2 flag does not generate an interrupt in this mode of operation.
P/N:PM0887
Specifications subject to change without notice, contact your sales representatives for the most update information.
17
REV. 1.6, MAR. 28, 2005
PRELIMINARY
MX10E8050I /
MX10E8050IA
(MSB)(LSB)
TF2EXF2RCLKTCLKEXEN2TR2C/T2
SymbolPositionName and Significance
TF2T2CON.7Timer 2 overflow flag set by a Timer 2 overflow and must be cleared by software. TF2 will not be set
EXF2T2CON.6Timer 2 external flag set when either a capture or reload is caused by a negative transition on T2EX and
RCLKT2CON.5Receive clock flag. When set, causes the serial port to use Timer 2 overflow pulses for its receive clock
TCLKT2CON.4Transmit clock flag. When set, causes the serial port to use Timer 2 overflow pulses for its transmit clock
EXEN2T2CON.3Timer 2 external enable flag. When set, allows a capture or reload to occur as a result of a negative
TR2T2CON.2Start/stop control for Timer 2. A logic 1 starts the timer.
C/T2
CP/RL2
T2CON.1Timer or counter select. (Timer 2)
T2CON.0Capture/Reload flag. When set, captures will occur on negative transitions at T2EX if EXEN2 = 1. When
when either RCLK or TCLK = 1.
EXEN2 = 1. When Timer 2 interrupt is enabled, EXF2 = 1 will cause the CPU to vector to the Timer 2
interrupt routine. EXF2 must be cleared by software. EXF2 does not cause an interrupt in up/down
counter mode (DCEN = 1).
in modes 1 and 3. RCLK = 0 causes Timer 1 overflow to be used for the receive clock.
in modes 1 and 3. TCLK = 0 causes Timer 1 overflows to be used for the transmit clock.
transition on T2EX if Timer 2 is not being used to clock the serial port. EXEN2 = 0 causes Timer 2 to
ignore events at T2EX.
0 = Internal timer (OSC/6 in 6 clock mode or OSC/12 in 12 clock mode)
1 = External event counter (falling edge triggered).
cleared, auto-reloads will occur either with Timer 2 overflows or negative transitions at T2EX when
EXEN2 = 1. When either RCLK = 1 or TCLK = 1, this bit is ignored and the timer is forced to auto-reload
on Timer 2 overflow .
CP/RL2
Figure 2. Timer / Counter 2 (T2CON) Control Register
Table 9 : Timer 2 Operation Modes
RCLK + TCLKCP / RL2TR2MODE
00116-bit Auto-reload
01116-bit Capture
1X1Baud rate generator
XX0( off )
P/N:PM0887
Specifications subject to change without notice, contact your sales representatives for the most update information.
18
REV. 1.6, MAR. 28, 2005
PRELIMINARY
MX10E8050I /
MX10E8050IA
OSC
T2 Pin
T2EX Pin
÷
n*
Transition
Detector
C/T2
C/T2
= 0
= 1
EXEN2
Control
TR2
Control
Capture
TL2
(8-bits)
RCAP2LRCAP2H
TH2
(8-bits)
TF2
EXF2
* n = 12 in 12 clock mode.
n = 6 in 6 clock mode.
Figure 3 : Timer 2 in Capture Mode
T2MODAddress = 0C9HReset Value = XXXX XX00B
Not Bit Addressable
Timer 2
Interrupt
DCENT2OE
Bit
76543210
SymbolFunction
- Not implemented, reserved for future use.*
T2OE Timer 2 Output Enable bit.
DCENDown Count Enable bit. When set, this allows Timer 2 to be configured as an up/down counter .
* User software should not write 1s to reserved bits. These bits may be used in future 8051 family products to invoke new features.
In that case, the reset or inactive value of the new bit will be 0, and its active value will be 1. The value read from a reserved bit is
indeterminate.
Figure 4 : Timer 2 Mode (T2MOD) Control Register
P/N:PM0887
Specifications subject to change without notice, contact your sales representatives for the most update information.
19
REV. 1.6, MAR. 28, 2005
PRELIMINARY
MX10E8050I /
MX10E8050IA
OSC
T2 PIN
T2EX PIN
÷
n*
TRANSITION
DETECTOR
* n = 12 in 12 clock mode.
n = 6 in 6 clock mode.
C/T2 = 0
C/T2
= 1
EXEN2
CONTROL
TR2
CONTROL
RELOAD
TL2
(8-BITS)
RCAP2LRCAP2H
TH2
(8-BITS)
Figure 5 : Timer 2 in Auto-Reload Mode (DCEN = 0)
(DOWN COUNTING RELOAD VALUE)
FFHFFH
TF2
EXF2
TOGGLE
TIMER 2
INTERRUPT
÷
OSC
n*
T2 PIN
* n = 12 in 12 clock mode.
n = 6 in 6 clock mode.
C/T2 = 0
C/T2
= 1
TL2TH2
OVERFLOW
CONTROL
TR2
RCAP2LRCAP2H
(UP COUNTING RELOAD VALUE)T2EX PIN
Figure 6 : Timer 2 Auto-Reload Mode (DCEN = 1)
COUNT
DIRECTION
1 = UP
0 = DOWN
TF2
EXF2
INTERRUPT
P/N:PM0887
Specifications subject to change without notice, contact your sales representatives for the most update information.
20
REV. 1.6, MAR. 28, 2005
OSC
T2 Pin
÷n*
Transition
Detector
C/T2 = 0
C/T2
= 1
TR2
Control
TL2
(8-bits)
RCAP2LRCAP2H
TH2
(8-bits)
PRELIMINARY
MX10E8050I /
MX10E8050IA
Timer 1
Overflow
÷2
"0"
"1"
"0"
"1"
÷ 16
÷ 16
Reload
"1"
"0"
SMOD
RCLK
RX Clock
TCLK
TX Clock
T2EX Pin
* n = 2 in 12 clock mode.
n = 1 in 6 clock mode.
EXF2
Control
EXEN2
Note availability of additional external interrupt.
Timer 2
Interrupt
Figure 7. Timer 2 in Baud Rate Generator Mode
Table 10 : Timer 2 Generated Commonly Used Baud Rates
Bits TCLK and / or RCLK in T2CON (Table 10) allow the serial port transmit and receive baud rates to be derived
from either Timer 1 or Timer 2. When TCLK = 0, Timer 1 is used as the serial port transmit baud rate generator.
When TCLK = 1, Timer 2 is used as the serial port transmit baud rate generator. RCLK has the same effect for
the serial port receive baud rate. With there two bits, the serial port can have different receive and transmit baud
rates - one generated by Timer1, the other by Timer2.
Figure 7 shows the Timer2 in baud rate generation mode. The baud rate generation mode is like the auto-reload
mode, in that a rollover in TH2 causes the Timer 2 registers to be reloaded with the 16-bit value in registers
RCAP2H and RCAP2L, which are preset by software.
The baud rates in modes 1 and 3 are determined by Timer 2's overflow rate given below :
Timer 2 Overflow Rate
Modes 1 and 3 Baud Rates =
16
P/N:PM0887
Specifications subject to change without notice, contact your sales representatives for the most update information.
21
REV. 1.6, MAR. 28, 2005
PRELIMINARY
MX10E8050I /
MX10E8050IA
The Timer can be configured for either "timer" or "counter" operation. In many applications, it is configured for
"timer" operation ( C/T 2* = 0). Timer operation is different for Timer 2 when it is being used as a baud rate
generator.
Usually, as a timer it would increment every machine cycle ( i.e., 1/6 the oscillator frequency in 6 clock mode, 1/
12 the oscillator frequency in 12 clock mode). As a baud rate generator, it increments at the oscillator frequency
in 6 clock mode (OSC/2 in 12 clock mode).
Thus the baud rate formula is as follows :
Oscillator Frequency
Modes 1 and 3 Baud Rates =
Where : (RCAP2h, RCAP2L) = The content of RCAP2H and RCAP2L taken as a 16-bit unsigned integer.
The Timer 2 as a baud rate generator mode shown in Figure7, is valid only if RCLK and / or TCLK = 1in T2CON
register. Note that a rollover in TH2 does not set TF2, and Will not generate an interrupt. Thus, the Timer 2
interrupt does not have to be disabled when Timer 2 is in the baudrate generator mode. Also if the EXEN2 (T2
external enable flag) is set, a 1-to-0 transition in T2EX (Timer / counter 2 trigger input) will set EXF2 (T2 external
flag) but will not cause a reload from (RCAP2H, RCAP2L) to (TH2, TL2). Therefore when Timer 2 is in use as a
baud rate generator, T2EX can be used as an additional external interrupt, if needed.
[ n * x [65536 - (RCAP2H, RCAP2L) ] ]
*n = 32 in 12 clock mode or 16 in 6 clock mode
When Timer 2 is in the baud rate generator mode, one should not try to read or write TH2 and TL2. As a baud rate
generator, Timer 2 is accurate. The RCAP2 registers may be read, but should not be written to, because a write
might overlap a reload and cause write and / or reload errors. The timer should be turned off (clear TR2) before
accessing the Timer 2 or RCAP2 registers.
Table 10 shows commonly used baud rates and how they can be obtained from Timer 2.
Summary Of Baud Rate Equations
Timer 2 is in baud rate generating mode. If Timer 2 is being clocked through pin T2(P1.0) the baud rate is :
Timer 2 Overflow Rate
Baud Rate =
16
If Timer 2 is being clocked internally, The baud rate is :
f
Baud Rate =
OSC
[ n * x [65536 - (RCAP2H, RCAP2L) ] ]
*n = 32 in 12 clock mode or 16 in 6 clock mode
Where f
= Oscillator Frequency
OSC
To obtain the reload value for RCAP2H and RCAP2L, the above equation can be rewritten as :
f
RCAP2H, RCAP2L = 65536 - ( )
OSC
n * x Baud Rate
Timer / Counter 2 Set-up
Except for the baud rate generator mode, the values given for T2CON do not include the setting of the TR2 bit.
Therefore, bit TR2 must be set, separately, to turn the timer on. see Table 11 for set-up of Timer 2 as a timer. Also
see Table 12 for set-up of Timer 2 as a counter.
P/N:PM0887
Specifications subject to change without notice, contact your sales representatives for the most update information.
22
REV. 1.6, MAR. 28, 2005
PRELIMINARY
MX10E8050I /
MX10E8050IA
Table 11 : Timer 2 as a Timer
T2CON
MODEINTERNAL CONTROLEXTERNAL CONTROL
(Note 1) (Note 2)
16-bit Auto-Reload 00H08H
16-bit Capture 01H09H
Baud rate generator receive and transmit same baud rate 34H36H
Receive only 24H26H
Transmit only 14H16H
1. Capture / reload occurs only on timer / counter overflow.
2. Capture / reload occurs on timer / counter overflow and a 1-to-0 transition on T2EX (P1.1) pin except when
Timer 2 is used in the baud rate generatior mode.
P/N:PM0887
Specifications subject to change without notice, contact your sales representatives for the most update information.
23
REV. 1.6, MAR. 28, 2005
PRELIMINARY
MX10E8050I /
MX10E8050IA
Interrupt system
The MX10E8050I Serial contains a 7-source (2 external interrupts, Timer 0, Timer1, Timer2, I2C and UART) with
four priority levels interrupt structure.
Each External interrupts INT0 and INT1, can be either level-activated or transition-activated depending on bits IT0
and IT1 in TCON SFR. The flags that actually generate these interrupts are bits IE0, IE1 in TCON. When an
external interrupt is generated, the corresponding request flag is cleared by the hardware where the service routine
is vectored to, if the interrupt is transition-activated. If the interrupt is level-activated the external source has to
hold the request active until the requested interrupt is actually generated. Then it has to deactive the request
before the interrupt service routine is completed, otherwise another interrupt will be generated.
The Timer 0 and Timer 1 Interrupts are generated by TF0 and TF1, which are set by a rollover in their respective
Timer/counter register (except for Timer 0 in Mode 3 of the serial interface). When a Timer interrupt is generated,
the flag that generated it is cleared by the on-chip hardware when the service routine is vectored to.
IE : INTERRUPT ENABLE REGISTER
This register is located at address A8H.
Table. 13IE SFR (A8H)
76543210
EAET2ES1ESET1EX1ET0EX0
(MSB)(LSB)
keep the above table with the following table
Table. 14 Description of IE bits
MNEMONIC POSITIONFUNCTION
EAIE.7Disable all interrupt
- Low, all disabled.
- High, each interrupt source is individually enabled or disabled by setting or
clearing its enable bit.
NAMEPRIORITY WITHIN LEVELVECTOR ADDRESS
IE0(HIGHEST) 10003H
I2C2002BH
TF03000BH
IE140013H
TF15001BH
RI + TI60023H
TF2 + EXF2(LOWEST)70033H
P/N:PM0887
Specifications subject to change without notice, contact your sales representatives for the most update information.
26
REV. 1.6, MAR. 28, 2005
PRELIMINARY
MX10E8050I /
MX10E8050IA
OSCILLATOR CHARACTERISTICS
XTAL1 and XTAL2 are the input and output, respectively, of an inverting amplifier. The pins can be configured for use
as an on-chip oscillator. To drive the device from an external clock source, XTAL1 should be driven while XTAL2 is left
unconnected. There are no requirements on the duty cycle of the external clock signal, because the input to the
internal clock circuitry is through a divide-by-two flip-flop. However, minimum and maximum high and low times
specified in the datasheet must be observed.
RESET
A reset is accomplished by holding the RST pin high for at least two and half machine cycles (15 oscillator periods in
6-clock mode, or 30 oscillator periods in 12-clock mode), while the oscillator is running. To ensure a good power-on
reset, the RST pin must be high long enough to allow the oscillator time to start up (normally a few milliseconds) plus
two machine cycles. At power-on, the voltage on VCC and RST must come up at the same time for a proper start-up.
Ports 1,2, and 3 will asynchronously be driven to their reset condition when a voltage above VIH (min.) is applied to
RST.
IDLE MODE
In idle mode, the CPU puts itself to sleep while all of the on-chip peripherals stay active. The instruction to invoke the
idle mode is the last instruction executed in the normal operating mode before the idle mode is activated. The CPU
contents, the on-chip RAM, and all of the special function registers remain intact during this mode. The idle mode can
be terminated either by any enabled interrupt (at which time the process is picked up at the interrupt service routine
and continued), or by a hardware reset which starts the processor in the same manner as a power-on reset.
POWER_DOWN MODE
In the power-down mode, the oscillator is stopped and the instruction to invoke power-down is the last instruction
executed. The power-down mode can be terminated by a RESET in the same way as in the 80C51 or in addition by
one of two external interrupts, INT0 or INT1. A termination with an external interrupt does ont affect the internal data
memory and does not affect the internal data memory and does not affect the special function registers. This makes
it possible to exit power-down without changing the port output levels. To terminate the power-down mode with any
external interrupt INT0 or INT1 must be switched to level-sensitive and must be enabled. The external interrupt input
signal INT0 and INT1 must be kept low until the oscillator has restarted and stabilized. An instruction following the
instruction that puts the device in the power-down mode will be executed. A reset generated by the watchdog timer
terminates the power-down mode in the same way as an external RESET, and only the contents of the on-chip RAM
are preserved. The control bits for the reduced power modes are in the special function register PCON.
DESIGN CONSIDERATIONS
At power-on, the voltage on VCC and RST must come up at the same time for a proper start-up.
When the idle mode is terminated by a hardware reset, the device normally resumes program exectution, from where
it left off, up to two machine cycles before the internal reset algorithm takes control. On-chip hardware inhibits access
to internal RAM in this event, but access to the port pins is not inhibited. To eliminate the possibility of an unexpected
write when idle is terminated by reset, the instruction following the one that invokes idle should not be one that writes
to a port pin or to external memory.
Table 19 shows the state of I/O ports during low current operation modes.
P/N:PM0887
Specifications subject to change without notice, contact your sales representatives for the most update information.
27
REV. 1.6, MAR. 28, 2005
Loading...
+ 62 hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.