30 REVISION HISTORY .............................................................................................................. 123
Publication Release Date: May 3, 2007
- 3 - Revision A7.1
W79E825A/824A/823B/822B Data Sheet
1. GENERAL DESCRIPTION
The W79E825 series are an 8-bit Turbo 51 microcontroller which has an in-system programmable
Flash EPROM which Flash EPROM can program by ICP (In Circuit Program) or by hardware writer.
The instruction set of the W79E825 series are fully compatible with the standard 8052. The W79E825
series contain a 16K/8K/4K/2K bytes of main Flash EPROM; a 256/128 bytes of RAM; 256/128 bytes
NVM Data Flash EPROM; two 8-bit bi-directional, one 2-bit bi-directional and bit-addressable I/O
ports; two 16-bit timer/counters; 4-channel multiplexed 10-bit A/D convert; 4-channel 10-bit PWM; two
serial ports that include a I2C and an enhanced full duplex serial port. These peripherals are
supported by 13 sources four-level interrupt capability. To facilitate programming and verification, the
Flash EPROM inside the W79E825 series allow the program memory to be programmed and read
electronically. Once the code is confirmed, the user can protect the code for security.
- 4 -
W79E825A/824A/823B/822B Data Sheet
2. FEATURES
• Fully static design 8-bit Turbo 51 CMOS microcontroller up to 20MHz when VDD=4.5V to 5.5V,
12MHz when VDD=2.7V to 5.5V
• 16K/8K/4K/2K bytes of AP Flash EPROM, with ICP and external writer programmable mode.
• 256/128 bytes of on-chip RAM.
• 256/128 bytes NVM Data Flash EPROM for customer data storage used and 10K writer cycles.
• Instruction-set compatible with MSC-51.
• On-chip configurable RC oscillator (6MHz)
• Two 8-bit bi-directional and one 2-bit bi-directional ports.
• Two 16-bit timer/counters.
• 13 interrupts source with four levels of priority.
• One enhanced full duplex serial port with framing error detection and automatic address
recognition.
• The 4 outputs mode and TTL/Schmitt trigger selectable Port.
CRYSTAL1: This is the crystal oscillator input. This pin may be driven by
an external clock or configurable I/O pin.
CRYSTAL2: This is the crystal oscillator output. It is the inversion of
XTAL1 or configurable I/O pin.
PORT 0: Port 0 is four mode output pin and two mode input. The
P0.3~P0.6 are 4-channel input ports (ADC0-ADC3) for ADC used.
PORT 1: Port 1 is four mode output pin and two mode input. The P1.2
(SCL) and P1.3 (SDA) is only open drain circuit, and P1.5 only input pin.
- 8 -
W79E825A/824A/823B/822B Data Sheet
6. FUNCTIONAL DESCRIPTION
The W79E825 series architecture consist of a 4T 8051 core controller surrounded by various registers,
16K/8K/4K/2K bytes Flash EPROM, 256/128 bytes of RAM, 256/128 bytes NVM Data Flash EPROM,
three general purpose I/O ports, two timer/counters, one serial port, one I2C serial I/O, 4 channel
PWM with 10-bit counter, 4-channel multiplexed with 10-bit ADC analog input, Flash EPROM program
by Writer and ICP.
6.1 On-Chip Flash EPROM
The W79E825 series include one 16K/8K/4K/2K bytes of main Flash EPROM for application program.
A Writer or ICP programming board is required to program the Flash EPROM or NVM Data Flash
EPROM.
This ICP (In-Circuit Programming) feature makes the job easy and efficient when the application’s
firmware needs to be updated frequently. In some applications, the in-circuit programming feature
makes it possible for the end-userto easily update the system firmware without opening the chassis.
6.2 I/O Ports
The W79E825 series have two 8-bit and one 2-bit port, up to 18 I/O pins using on-chip oscillator &
/RST is input only by reset options. All ports can be used as four outputs mode when it may set by
PxM1.y and PxM2.y SFR’s registers, it has strong pull-ups and pull-downs, and does not need any
external pull-ups. Otherwise it can be used as general I/O port as open drain circuit. All ports can be
used bi-directional and these are as I/O ports. These ports are not true I/O, but rather are pseudo-I/O
ports. This is because these ports have strong pull-downs and weak pull-ups.
6.3 Serial I/O
The W79E825 series have one serial port that is functionally similar to the serial port of the original
8032 family. However the serial port on the W79E825 series can operate in different modes in order to
obtain timing similarity as well. The Serial port has the enhanced features of Automatic Address
recognition and Frame Error detection.
6.4 Timers
The W79E825 series have two 16-bit timers that are functionally and similar to the timers of the 8052
family. When used as timers, the user has a choice of 12 or 4 clocks per count that emulates the
timing of the original 8052.
6.5 Interrupts
The Interrupt structure in the W79E825 series is slightly different from that of the standard 8052. Due
to the presence of additional features and peripherals, the number of interrupt sources and vectors
has been increased.
6.6 Data Pointers
The data pointers of W79E825 series are same as 8052 that has dual 16-bit Data Pointers (DPTR) by
setting DPS bit at AUXR1.0. The figure of dual DPTR is as below diagram.
Publication Release Date: May 3, 2007
- 9 - Revision A7.1
W79E825A/824A/823B/822B Data Sheet
AUXR1.0
DPS=0
DPTR
DPS
DPS=1
Figure 6-1: Dual DPTR
DPTR1
6.7 Architecture
The W79E825 series are based on the standard 8052 device. It is built around an 8-bit ALU that uses
internal registers for temporary storage and control of the peripheral devices. It can execute the
standard 8052 instruction set.
6.7.1 ALU
The ALU is the heart of the W79E825 series. It is responsible for the arithmetic and logical functions. It
is also used in decision making, in case of jump instructions, and is also used in calculating jump
addresses. The user cannot directly use the ALU, but the Instruction Decoder reads the op-code,
decodes it, and sequences the data through the ALU and its associated registers to generate the
required result. The ALU mainly uses the ACC which is a special function register (SFR) on the chip.
Another SFR, namely B register is also used in Multiply and Divide instructions. The ALU generates
several status signals which are stored in the Program Status Word register (PSW).
6.7.2 Accumulator
The Accumulator (ACC) is the primary register used in arithmetic, logical and data transfer operations
in the W79E825 series. Since the Accumulator is directly accessible by the CPU, most of the high
speed instructions make use of the ACC as one argument.
6.7.3 B Register
This is an 8-bit register that is used as the second argument in the MUL and DIV instructions. For all
other instructions it can be used simply as a general purpose register.
6.7.4 Program Status Word:
This is an 8-bit SFR that is used to store the status bits of the ALU. It holds the Carry flag, the Auxiliary
Carry flag, General purpose flags, the Register Bank Select, the Overflow flag, and the Parity flag.
6.7.5 Scratch-pad RAM
The W79E825 series have a 256/128 bytes on-chip scratch-pad RAM. These can be used by the user
for temporary storage during program execution. A certain section of this RAM is bit addressable, and
can be directly addressed for this purpose.
- 10 -
W79E825A/824A/823B/822B Data Sheet
6.7.6 Stack Pointer
The W79E825 series have an 8-bit Stack Pointer which points to the top of the Stack. This stack
resides in the Scratch Pad RAM in the W79E825 series. Hence the size of the stack is limited by the
size of this RAM.
6.8 Power Management
Power Management like the standard 8052, the W79E825 series also have the IDLE and POWER
DOWN modes of operation. In the IDLE mode, the clock to the CPU is stopped while the timers, serial
ports and interrupt lock continue to operate. In the POWER DOWN mode, all clocks are stopped and
the chip operation is completely stopped. This is the lowest power consumption state.
Publication Release Date: May 3, 2007
- 11 - Revision A7.1
W79E825A/824A/823B/822B Data Sheet
7. MEMORY ORGANIZATION
The W79E825 series separate the memory into two separate sections, the Program Memory and the
Data Memory. The Program Memory is used to store the instruction op-codes, while the Data Memory
is used to store data or for memory mapped devices.
7.1 Program Memory (on-chip Flash)
The Program Memory on the W79E825 series can be up to 16K/8K/4K/2K bytes long. All instructions
are fetched for execution from this memory area. The MOVC instruction can also access this memory
region.
7.2 Data Memory
The NVM Data Memory of Flash EPROM on the W79E825 series can be up to 256/128 bytes long.
The W79E825 series read the content of data memory by using “MOVC A, @A+DPTR”. To write data
is by NVMADDR, NVMDAT and NVMCON SFR’s registers.
FFFFH
FCFFH
FC00H
FBFFH
4000H/2000H
3FFFH/1FFFH
0000H
On-Chip Code Memory Space
Unused
Code Memory
256 Bytes
NVM
Data Mem ory
Unused
Code Memory
16K/8K Bytes
On-Chip
Code Memory
Page 3
64 bytes
Page 2
64 bytes
Page 1
64 bytes
Page 0
64 bytes
FCFFH
FCC0H
FCBFH
FC80H
FC7FH
FC40H
FC3FH
FC00H
NVM Data Memory Area
CONFIG 2
CONFIG 1
Figure 7-1: W79E825/824 Memory Map
- 12 -
W79E825A/824A/823B/822B Data Sheet
FFFFH
Unused
Code Memory
FC7FH
FC00H
1000H/0800H
0FFFH/07FFH
0000H
On-Chip Code Memory Space
128 Bytes
NVM
Data Mem o ry
Unused
Code Memory
4K/2K Bytes
On-Chip
Code Memory
Figure 7-2: W79E823/822 Memory Map
NVM Data Memory area
CONFIG 2
CONFIG 1
Page 1
64 bytes
Page 0
64 bytes
FC7FH
FC40H
FC3FH
FC00H
7.3 Register Map
As mentioned before the W79E825 series have separate Program and Data Memory areas. The onchip 256/128 bytes scratch pad RAM is in addition to the external memory. There are also several
Special Function Registers (SFRs) which can be accessed by software. The SFRs can be accessed
only by direct addressing, while the on-chip RAM can be accessed by either direct or indirect
addressing.
Publication Release Date: May 3, 2007
- 13 - Revision A7.1
W79E825A/824A/823B/822B Data Sheet
FFH
Indirect
RAM
Addressing
80H
7FH
00H
Figure 7-3: W79E825 and W79E824 RAM and SFR memory map
Direct
&
Indirect
RAM
Addressing
RAM and SFR Data Memory Space
SFR
Direct
Addressing
Only
FFH
Unused
Indirect
RAM
SFR
Direct
Addressing
Only
80H
7FH
Direct & Indirect
RAM
Addressing
00H
RAM and SFR Data Memory Space
Figure 7-4: W79E823 and W79E822 RAM and SFR memory map
Since the scratch-pad RAM is only 256/128 bytes it can be used only when data contents are small.
There are several other special purpose areas within the scratch-pad RAM. These are described as
follows.
- 14 -
W79E825A/824A/823B/822B Data Sheet
FFH
Indirect RAM
80H
7FH
Direct RAM
30H
34
Bank 3
Bank 2
Bank 1
Bank 0
7B7A79787C7D7E7F
7372717074757677
6B6A69686C6D6E6F
6362616064656667
5B5A59585C5D5E5F
5352515054555657
4B4A49484C4D4E4F
4342
3B3A39383C3D3E3F
33
32
2B2A29282C2D2E2F
2322212024252627
1B1A19181C1D1E1F
1312111014151617
0B0A09080C0D0E0F
0302010004050607
41
31
4044
30
2FH
2EH
2DH
2CH
2BH
2AH
29H
28H
27H
26H
25H
24H
23H
22H
21H
20H
1FH
18H
17H
10H
0FH
08H
07H
00H
454647
353637
Figure 7-5: Scratch pad RAM
- 15 - Revision A7.1
Publication Release Date: May 3, 2007
W79E825A/824A/823B/822B Data Sheet
7.4 Working Registers
There are four sets of working registers, each consisting of eight 8-bit registers. These are termed as
Banks 0, 1, 2, and 3. Individual registers within these banks can be directly accessed by separate
instructions. These individual registers are named as R0, R1, R2, R3, R4, R5, R6 and R7. However, at
one time the W79E825 series can work with only one particular bank. The bank selection is done by
setting RS1-RS0 bits in the PSW. The R0 and R1 registers are used to store the address for indirect
accessing.
7.5 Bit addressable Locations
The Scratch-pad RAM area from location 20h to 2Fh is byte as well as bit addressable. This means
that a bit in this area can be individually addressed. In addition some of the SFRs are also bit
addressable. The instruction decoder is able to distinguish a bit access from a byte access by the type
of the instruction itself. In the SFR area, any existing SFR whose address ends in a 0 or 8 is bit
addressable.
7.6 Stack
The scratch-pad RAM can be used for the stack. This area is selected by the Stack Pointer (SP),
which stores the address of the top of the stack. Whenever a jump, call or interrupt is invoked the
return address is placed on the stack. There is no restriction as to where the stack can begin in the
RAM. By default however, the Stack Pointer contains 07h at reset. The user can then change this to
any value desired. The SP will point to the last used value. Therefore, the SP will be incremented and
then address saved onto the stack. Conversely, while popping from the stack the contents will be read
first, and then the SP is decreased.
- 16 -
W79E825A/824A/823B/822B Data Sheet
8. SPECIAL FUNCTION REGISTERS
The W79E825 series uses Special Function Registers (SFRs) to control and monitor peripherals and
their Modes. The SFRs reside in the register locations 80-FFh and are accessed by direct addressing
only. Some of the SFRs are bit addressable. This is very useful in cases where users wish to modify a
particular bit without changing the others. The SFRs that are bit addressable are those whose
addresses end in 0 or 8. The W79E825 series contain all the SFRs present in the standard 8052.
However some additional SFRs are added. In some cases the unused bits in the original 8052, have
been given new functions. The list of the SFRs is as follows.
F8
F0
E8
E0
D8
D0
C8
C0
B8
B0
A8
A0
98
90
88
80
IP1
B P0ID IP1H
EIE
ACC ADCCON ADCH
WDCON PWMPL PWM0LPWM1LPWMCON1PWM2L
PSW PWMPH PWM0HPWM1H
NVMCON NVMDAT
I2CON I2ADDR NVMADDR TA
IP0 SADEN I2DAT I2STATUSI2CLK I2TIMER
P0M1 P0M2 P1M1 P1M2 P2M1 P2M2 IP0H
IE SADDR CMP1 CMP2
P2 KBI AUXR1
SCON SBUF
P1 DIVM
TCON TMOD TL0 TL1 TH0 TH1 CKCON
P0 SP DPL DPH PCON
PWM2HPWM3H PWMCON3
PWM3L PWMCON2
Table 8-1: Special Function Register Location Table
Note: 1. The SFRs in the column with dark borders are bit-addressable
2. The table is condensed with eight locations per row. Empty locations indicate that these are no registers at these
addresses. When a bit or register is not implemented, it will read high.
PCON Power control 87H SMOD SMOD0 BOF POR GF1 GF0 PD IDL 00xx0000B
DPH Data pointer high 83H 00000000B
DPL Data pointer low 82H 00000000B
SP Stack pointer 81H 00000111B
P0 Port 0 80H
Comparator 2 control
register
Comparator 1 control
register
MSB BIT_
ESS
LSB
ADH - - CE2 CP2 CN2 OE2 CO2 CMF2 00000000B
ACH - - CE1 CP1 CN1 OE1 CO1 CMF1 00000000B
(AF)
EA
(A7) - (A6) - (A5) - (A4) - (A3) - (A2) - (A1)
(9F)
SM0/FE
(97)
PWM2
(8F)
TF1
(87)
T1
(AE)
EADC
(9E)
SM1
(96)
PWM1
(8E)
TR1
(86)
AD3
CMP1
(AD)
EBO
(9D)
SM2
(95)
/RST
(8D)
TF0
(85)
AD2
CMPREF
(AC)
ES
(9C)
REN
(94)
/INT1
(8C)
TR0
(84)
AD1
CIN1A
Table 8-2: Special Function Registers
DDRESS, SYMBOL
(AB)
ET1
(9B)
TB8
(93)
/INT0
SDL
(8B)
IE1
(83)
AD0
CIN1B
(AA)
EX1
(9A)
RB8
(92)
T0
SCL
(8A)
IT1
(82)
BRAKE
CIN2A
(A9)
ET0
XTAL1
(99)
TI
(91)
RXD
(89)
IE0
(81)
PWM0
CIN2B
(A8)
EX0
(A0)
XTAL2
CLKOUT
(98)
RI
(90)
TXD
(88)
IT0
(80)
PWM3
CMP2
RESET
00000000B
xxxxxx11B
00000000B
11111111B
00000000B
11111111B
Publication Release Date: May 3, 2007
- 19 - Revision A7.1
W79E825A/824A/823B/822B Data Sheet
PORT 0
Bit: 7 6 5 4 3 2 1 0
P0.7 P0.6 P0.5 P0.4 P0.3 P0.2 P0.1 P0.0
Mnemonic: P0 Address: 80h
P0.7-0: General purpose Input/Output port. Most instructions will read the port pins in case of a port
read access, however in case of read-modify-write instructions, the port latch is read. These alternate
functions are described below:
BIT NAME FUNCTION
7 P0.7 Timer 1 pin or KBI.7 pin of keypad input.
6 P0.6 CMP1 pin of analog comparator or KBI.6 pin of keypad input or AD3 of AD converter.
5 P0.5 CMPREF pin of analog comparator or KBI.5 pin of keypad input or AD2 of AD
converter.
4 P0.4 CIN1A pin of analog comparator or KBI.4 pin of keypad input or AD1 of AD converter
3 P0.3 CIN1B pin of analog comparator or KBI.3 pin of keypad input or AD0 of AD converter.
2 P0.2 BRAKE pin of PWM or CIN2A pin of analog comparator or KBI.2 pin of keypad input.
1 P0.1 PWM0 pin or CIN2B pin of analog comparator or KBI.1 pin of keypad input.
0 P0.0 PWM3 pin or CMP2 pin of analog comparator or KBI.0 pin of keypad input.
Note: The initial value of the port is set by CONFIG1.PRHI bit. The default setting for CONFIG1.PRHI =1 which the alternative
function output is turned on upon reset. If CONFIG1.PRHI is set to 0, the user has to write a 1 to port SFR to turn on the
alternative function output.
STACK POINTER
Bit: 7 6 5 4 3 2 1 0
SP.7 SP.6 SP.5 SP.4 SP.3 SP.2 SP.1 SP.0
Mnemonic: SP Address: 81h
BIT NAME FUNCTION
7-0 SP.[7:0]
DATA POINTER LOW
Bit: 7 6 5 4 3 2 1 0
DPL.7 DPL.6 DPL.5 DPL.4 DPL.3 DPL.2 DPL.1 DPL.0
Mnemonic: DPL Address: 82h
BIT NAME FUNCTION
7-0 DPL.[7:0] This is the low byte of the standard 8052 16-bit data pointer.
The Stack Pointer stores the Scratch-pad RAM address where the stack begins. In
other words it always points to the top of the stack.
DATA POINTER HIGH
Bit: 7 6 5 4 3 2 1 0
DPH.7 DPH.6 DPH.5 DPH.4 DPH.3 DPH.2 DPH.1 DPH.0
Mnemonic: DPH Address: 83h
- 20 -
W79E825A/824A/823B/822B Data Sheet
BIT NAME FUNCTION
7-0 DPH.[7:0]
POWER CONTROL
Bit: 7 6 5 4 3 2 1 0
SMOD SMOD0 BOF POR GF1 GF0 PD IDL
Mnemonic: PCON Address: 87h
BIT NAME FUNCTION
7 SMOD 1: This bit doubles the serial port baud rate in mode 1, 2, and 3.
6 SMOD0
5 BOF
This is the high byte of the standard 8052 16-bit data pointer.
This is the high byte of the DPTR 16-bit data pointer.
0: Framing Error Detection Disable. SCON.7 (SM0/FE) bit is used as SM0
(standard 8052 function).
1: Framing Error Detection Enable. SCON.7 (SM0/FE) bit is used to reflect as
Frame Error (FE) status flag.
0: Cleared by software.
1: Set automatically when a brownout reset or interrupt has occurred. Also set at
power on.
4 POR
3 GF1 General purpose user flags.
2 GF0 General purpose user flags.
1 PD
0 IDL
TIMER CONTROL
Bit: 7 6 5 4 3 2 1 0
TF1 TR1 TF0 TR0 IE1 IT1 IE0 IT0
Mnemonic: TCON Address: 88h
BIT NAME FUNCTION
7 TF1
6 TR1
0: Cleared by software.
1: Set automatically when a power-on reset has occurred.
1: The CPU goes into the POWER DOWN mode. In this mode, all the clocks are
stopped and program execution is frozen.
1: The CPU goes into the IDLE mode. In this mode, the clocks CPU clock
stopped, so program execution is frozen. But the clock to the serial, timer and
interrupt blocks is not stopped, and these blocks continue operating.
Timer 1 Overflow Flag. This bit is set when Timer 1 overflows. It is cleared
automatically when the program does a timer 1 interrupt service routine. Software
can also set or clear this bit.
Timer 1 Run Control. This bit is set or cleared by software to turn timer/counter on
or off.
Publication Release Date: May 3, 2007
- 21 - Revision A7.1
W79E825A/824A/823B/822B Data Sheet
Continued
BIT NAME FUNCTION
Timer 0 Overflow Flag. This bit is set when Timer 0 overflows. It is cleared
5 TF0
automatically when the program does a timer 0 interrupt service routine. Software
can also set or clear this bit.
4 TR0
3 IE1
2 IT1
1 IE0
0 IT0
TIMER MODE CONTROL
Bit: 7 6 5 4 3 2 1 0
GATE
TIMER1 TIMER0
Mnemonic: TMOD Address: 89h
BIT NAME FUNCTION
Timer 0 Run Control. This bit is set or cleared by software to turn timer/counter on
or off.
Interrupt 1 Edge Detect Flag: Set by hardware when an edge/level is detected on
INT1
. This bit is cleared by hardware when the service routine is vectored to only if
the interrupt was edge triggered. Otherwise it follows the inverse of the pin.
Interrupt 1 Type Control. Set/cleared by software to specify falling edge/ low level
triggered external inputs.
Interrupt 0 Edge Detect Flag. Set by hardware when an edge/level is detected on
INT0
. This bit is cleared by hardware when the service routine is vectored to only if
the interrupt was edge triggered. Otherwise it follows the inverse of the pin.
Interrupt 0 Type Control: Set/cleared by software to specify falling edge/ low level
triggered external inputs.
TC /
M1 M0 GATE
TC /
M1 M0
Gating control: When this bit is set, Timer/counter 1 is enabled only while the
GATE
7
6
M1 Timer 1 mode select bit 1. See table below.
5
M0 Timer 1 mode select bit 0. See table below.
4
GATE
3
2
M1 Timer 0 mode select bit 1. See table below.
1
M0 Timer 0 mode select bit 0. See table below.
0
pin is high and the TR1 control bit is set. When cleared, the
and Timer 1 is enabled whenever TR1 control bit is set.
Timer or Counter Select: When clear, Timer 1 is incremented by the internal clock.
TC/
When set, the timer counts falling edges on the T1 pin.
Gating control: When this bit is set, Timer/counter 0 is enabled only while the
pin is high and the TR0 control bit is set. When cleared, the
and Timer 0 is enabled whenever TR0 control bit is set.
Timer or Counter Select: When clear, Timer 0 is incremented by the internal clock.
TC/
When set, the timer counts falling edges on the T0 pin.
INT1
INT1 pin has no effect,
INT0
INT0 pin has no effect,
- 22 -
W79E825A/824A/823B/822B Data Sheet
M1, M0: Mode Select bits:
M1 M0 MODE
0 0
Mode 0: 8-bit timer/counter TLx serves as 5-bit pre-scale.
0 1
1 0
1 1
TIMER 0 LSB
Bit: 7 6 5 4 3 2 1 0
TL0.7 TL0.6 TL0.5 TL0.4 TL0.3 TL0.2 TL0.1 TL0.0
Mnemonic: TL0 Address: 8Ah
BIT NAME FUNCTION
7-0 TL0.[7:0] Timer 0 LSB.
TIMER 1 LSB
Bit: 7 6 5 4 3 2 1 0
TL1.7 TL1.6 TL1.5 TL1.4 TL1.3 TL1.2 TL1.1 TL1.0
Mnemonic: TL1 Address: 8Bh
BIT NAME FUNCTION
7-0 TL1.[7:0] Timer 1 LSB.
Mode 1: 16-bit timer/counter, no pre-scale.
Mode 2: 8-bit timer/counter with auto-reload from THx.
Mode 3: (Timer 0) TL0 is an 8-bit timer/counter controlled by the standard Timer0
control bits. TH0 is an 8-bit timer only controlled by Timer1 control bits.
(Timer 1) Timer/Counter 1 is stopped.
TIMER 0 MSB
Bit: 7 6 5 4 3 2 1 0
TH0.7 TH0.6 TH0.5 TH0.4 TH0.3 TH0.2 TH0.1 TH0.0
Mnemonic: TH0 Address: 8Ch
BIT NAME FUNCTION
7-0 TH0.[7:0] Timer 0 MSB.
TIMER 1 MSB
Bit: 7 6 5 4 3 2 1 0
TH1.7 TH1.6 TH1.5 TH1.4 TH1.3 TH1.2 TH1.1 TH1.0
Mnemonic: TH1 Address: 8Dh
BIT NAME FUNCTION
7-0 TH1.[7:0] Timer 1 MSB.
Publication Release Date: May 3, 2007
- 23 - Revision A7.1
W79E825A/824A/823B/822B Data Sheet
CLOCK CONTROL
Bit: 7 6 5 4 3 2 1 0
- - - T1M T0M - - -
Mnemonic: CKCON Address: 8Eh
BIT NAME FUNCTION
7-5
4
3
- Reserved.
Timer 1 clock select:
T1M
T0M
0: Timer 1 uses a divide by 12 clocks.
1: Timer 1 uses a divide by 4 clocks.
Timer 0 clock select:
0: Timer 0 uses a divide by 12 clocks.
1: Timer 0 uses a divide by 4 clocks.
2-0
PORT 1
Bit: 7 6 5 4 3 2 1 0
P1.7 P1.6 P1.5 P1.4 P1.3 P1.2 P1.1 P1.0
Mnemonic: P1 Address: 90h
P1.7-0: General purpose Input/Output port. Most instructions will read the port pins in case of a port
read access, however in case of read-modify-write instructions, the port latch is read. These alternate
functions are described below:
BIT NAME FUNCTION
7 P1.7 PWM 2 Pin.
6 P1.6 PWM 1 Pin.
5 P1.5 /RST Pin or Input Pin by alternative.
4 P1.4 /INT1 interrupt.
3 P1.3 /INT0 interrupt or SDA of I2C.
2 P1.2 Timer 0 or SCL of I2C.
1 P1.1 RXD of Serial port.
0 P1.0 TXD of Serial port.
Note: The initial value of the port is set by CONFIG1.PRHI bit. The default setting for CONFIG1.PRHI =1 which the alternative
function output is turned on upon reset. If CONFIG1.PRHI is set to 0, the user has to write a 1 to port SFR to turn on the
alternative function output.
7-0 DIVM.[7:0] The DIVM register is clock divider of uC. Refer OSCILLATOR chapter.
SERIAL PORT CONTROL
Bit: 7 6 5 4 3 2 1 0
SM0/FE SM1 SM2 REN TB8 RB8 TI RI
Mnemonic: SCON Address: 98h
BIT NAME FUNCTION
Serial port mode select bit 0 or Framing Error Flag: The SMOD0 bit in PCON SFR
SM0/FE
7
SM1 Serial Port mode select bit 1. See table below.
6
SM2
5
determines whether this bit acts as SM0 or as FE. The operation of SM0 is
described below. When used as FE, this bit will be set to indicate an invalid stop
bit. This bit must be manually cleared in software to clear the FE condition.
Multiple processors communication. Setting this bit to 1 enables the multiprocessor
communication feature in mode 2 and 3. In mode 2 or 3, if SM2 is set to 1, then RI
will not be activated if the received 9th data bit (RB8) is 0. In mode 1, if SM2 = 1,
then RI will not be activated if a valid stop bit was not received. In mode 0, the SM2
bit controls the serial port clock. If set to 0, then the serial port runs at a divide by
12 clock of the oscillator. This gives compatibility with the standard 8052. When set
to 1, the serial clock become divide by 4 of the oscillator clock. This results in faster
synchronous serial communication.
4
3
2
1
0
REN
TB8
RB8
TI
RI
Receive enable:
0: Disable serial reception.
1: Enable serial reception.
This is the 9th bit to be transmitted in modes 2 and 3. This bit is set and cleared by
software as desired.
In modes 2 and 3 this is the received 9th data bit. In mode 1, if SM2 = 0, RB8 is the
stop bit that was received. In mode 0 it has no function.
Transmit interrupt flag: This flag is set by hardware at the end of the 8th bit time in
mode 0, or at the beginning of the stop bit in all other modes during serial
transmission. This bit must be cleared by software.
Receive interrupt flag: This flag is set by hardware at the end of the 8th bit time in
mode 0, or halfway through the stop bits time in the other modes during serial
reception. However the restrictions of SM2 apply to this bit. This bit can be cleared
only by software.
Serial data on the serial port is read from or written to this location. It actually
7-0 SBUF.[7:0]
consists of two separate internal 8-bit registers. One is the receive resister, and
the other is the transmit buffer. Any read access gets data from the receive data
buffer, while write access is to the transmit data buffer.
Tclk divided by 4 or 12
Variable
Tclk divided by 32 or 64
Variable
PORT 2
Bit: 7 6 5 4 3 2 1 0
- - - - - - P2.1 P2.0
Mnemonic: P2 Address: A0h
BIT NAME FUNCTION
7-2 - Reserved
1 P2.1 XTAL1 clock input pin.
0 P2.0 XTAL2 or CLKOUT pin by alternative.
Note: The initial value of the port is set by CONFIG1.PRHI bit. The default setting for CONFIG1.PRHI =1 which the alternative
function output is turned on upon reset. If CONFIG1.PRHI is set to 0, the user has to write a 1 to port SFR to turn on the
alternative function output.
KEYBOARD INTERRUPT
Bit: 7 6 5 4 3 2 1 0
KBI.7 KBI.6 KBI.5 KBI.4 KBI.3 KBI.2 KBI.1 KBI.0
Mnemonic: KBI Address: A1h
BIT NAME FUNCTION
7
6
KBI.7 1: Enable P0.7 as a cause of a Keyboard interrupt.
KBI.6 1: Enable P0.6 as a cause of a Keyboard interrupt.
5
4
KBI.5 1: Enable P0.5 as a cause of a Keyboard interrupt.
KBI.4 1: Enable P0.4 as a cause of a Keyboard interrupt.
- 26 -
W79E825A/824A/823B/822B Data Sheet
Continued .
BIT NAME FUNCTION
3
KBI.3 1: Enable P0.3 as a cause of a Keyboard interrupt.
2
1
0
AUX FUNCTION REGISTER 1
Bit: 7 6 5 4 3 2 1 0
KBF BOD BOI LPBOV SRST ADCEN 0 DPS
Mnemonic: AUXR1 Address: A2h
BIT NAME FUNCTION
7 KBF
6 BOD
5 BOI
KBI.2 1: Enable P0.2 as a cause of a Keyboard interrupt.
KBI.1 1: Enable P0.1 as a cause of a Keyboard interrupt.
KBI.0 1: Enable P0.0 as a cause of a Keyboard interrupt.
Keyboard Interrupt Flag:
1: When any pin of port 0 that is enabled for the Keyboard Interrupt function goes
low. Must be cleared by software.
Brown Out Disable:
0: Enable Brownout Detect function.
1: Disable Brownout Detect function and save power.
Brown Out Interrupt:
0: Disable Brownout Detect Interrupt function and it will cause chip reset when
BOF is set.
1: This prevents Brownout Detection from causing a chip reset and allows the
Brownout Detect function to be used as an interrupt.
Low Power Brown Out Detect control:
0: When BOD is enable, the Brown Out detect is always turned on by normal run
or Power Down mode.
4 LPBOV
3 SRST
2 ADCEN
1 0 Reserved.
0 DPS
1: When BOD is enable, the Brown Out detect circuit is turned on by Power
Down mode. This control can help save 15/16 of the Brownout circuit power.
When uC is in Power Down mode, the BOD will enable internal RC OSC
(2MHz~0.5MHZ)
Software reset:
1: reset the chip as if a hardware reset occurred.
0: Disable ADC circuit.
1: Enable ADC circuit.
Dual Data Pointer Select
0: To select DPTR of standard 8051.
1: To select DPTR1
Publication Release Date: May 3, 2007
- 27 - Revision A7.1
W79E825A/824A/823B/822B Data Sheet
INTERRUPT ENABLE
Bit: 7 6 5 4 3 2 1 0
EA EADC EBO ES ET1 EX1 ET0 EX0
Mnemonic: IE Address: A8h
BIT NAME FUNCTION
7 EA Global enable. Enable/Disable all interrupts.