stk6032 Ds v1
stk6032 Ds v1
8051-based
8-bit microcontroller
with
ISP-programmable
64K flash memory
for Program Memory
The STK6032 is not designed for use in life support appliances, V1 2008 Jul 09
devices, or systems where malfunction of these products can
reasonably be expected to result in personal injury. Syntek
customers using or selling STK6032 for use in such applications do
so at their own risk and agree to fully indemnify Syntek for any
damages resulting from such improper use or sale.
Syntek Semiconductors Product specification
1 FEATURES
2 ORDERING INFORMATION
3 FUNCTIONAL BLOCK DIAGRAM
4 PINNING INFORMATION
4.4 Pin description
5 REDUCING ELECTROMAGNETIC EMISSION
5.1 Filtering
5.2 Turning off ALE
6 CENTRAL PROCESSING UNIT (CPU)
6.1 Instruction Set and addressing modes
6.2 CPU clock and Chip Configuration Register (SFR CHIPCON)
6.3 Instruciton Cycle
6.4 Program Status Word
7 MEMORY ORGANIZATION
7.1 Program Memory
7.1.1 Proram ROM space
7.1.2 On-chip Program Memory versus External program Memory
7.1.3 ISP prgramming for the 64K flash memory
7.1.4 ROM code protection
7.2 Main Data RAM and Special Function Register (SFR)
7.2.1 The lower 128 bytes of the Main Data RAM
7.3 AUX Memory
7.3.1 AUX Memory space
7.3.2 On-chip AUX Memory
7.3.3 Dual Data Pointer (Data Pointer 0 and Data Pointer 1) and DPTR Select Register (SFR DPS)
7.3.4 Stretch Memory Cycles for accessing external AUX memory and Clock Control Register
8 SPECIAL FUNCTION REGISTERS
8.1 SFR Map Overview
8.2 SFR of Each Functional Block
9 PORT 0, PORT 1, PORT 2, PORT 3, AND PORT 4
9.1 General Description
9.2 Port 0
9.3 Port 1, Port 2, and Port 3
9.4 Port 4
9.5 MOVX instruction, Port 0, Port 2, P3.6, P3.7
9.6 Multiple-Function Port Pins
10 TIMER/COUNTER 0, TIMER/COUNTER 1
10.1 General Description
10.2 Mode Selection Regiser, SFR TMOD ( at 89H of SFR space)
10.3 Timer 0/1 Control Register (SFR TCON at 88 H of the SFR space)
10.4 Clock Control Register, SFR CKCON, at address 8E hex of the SFR map
10.5 Operating Modes
10.5.1 Mode 0 (13-bit timer/counter)
10.5.2 Mode 1 (16-bit timer/counter)
10.5.3 Mode 2 (8-bit counter with auto-reload)
10.5.4 Mode 3 (two 8-bit counters from timer 0)
11 RESET
V1 2008 Jul 09 2
Syntek Semiconductors Product specification
V1 2008 Jul 09 3
Syntek Semiconductors Product specification
V1 2008 Jul 09 4
Syntek Semiconductors Product specification
V1 2008 Jul 09 5
Syntek Semiconductors Product specification
V1 2008 Jul 09 6
Syntek Semiconductors Product specification
V1 2008 Jul 09 7
Syntek Semiconductors Product specification
V1 2008 Jul 09 8
Syntek Semiconductors STK6032
1 FEATURES
• 80C51 Central Processing Unit (CPU).
– Option for multiple CPU clock (XTAL1, XTAL1 x 2, or XTAL1 / 3.
– Binary-code compatible with industrial standard 80C51 instruction set.
– Normal mode, idle mode, and stop mode.
• Program Memory : 64 kbytes on-chip flash memory.
– with hardware ISP (In-System Programming).
– Program code protection.
• Main Data RAM: 256 bytes (upper 128 + lower 128 bytes) of on-chip SRAM.
• Aux Memory (AUX RAM): 768 bytes of SRAM.
• Stretched memory cycle for the MOVX instruction.
• SFRs (Special Function Register): 46 SFRs.
• Timers: Timer 0, Timer 1, and Timer 2.
• On-chip Watchdog Timer.
• Full-duplex UART
• Five 8-bits I/O ports: Port 0, Port 1, Port 2, Port 3, and Port 4.
• On-chip power-on-reset with low-voltage detection and reset.
• Interrupts: 6 sources, 2 priority level, 6 vectored addresses.
• Software enable/disable of ALE output pulse to reduce EMI.
• 6-channel, 6-bit ADC.
• 5-channel, 8-bit PWM.
• CPU operating frequency range: 2 to 30 MHz
• Operating temperature range: -40 to +85°C
• Operating voltage range: 4.5 to 5.5 V.
• ESD, Human Body Model: > 3 KV
• ESD, Machines model: > 350 V
• Latch-up > 100 mA.
• Relibility of 64K flash memory:
– Data retention: 10 years at room temperature.
– Number of read/write cycle: > 20K.
• Available in 3 types of Pb-free package: PLCC44, QFP44, LQFP48.
V1 2008 Jul 09 9
Syntek Semiconductors STK6032
2 ORDERING INFORMATION
V1 2008 Jul 09 10
Syntek Semiconductors STK6032
P0.0/AD0
ALE Internal Bus P0.1/AD1
PSEN 8051 CPU P0.2/AD2
EA Port 0 P0.3/AD3
P0.4/AD4
P0.5/AD5
data bus and
Program Flash P0.6/AD6
address bus for
Memory (64K) P0.7/AD7 external memory
P2.0/A8 access
P2.1/A9
Main Data Memory P2.2/A10
ISP CONTROL (256 bytes)
Port 2 P2.3/A11
P2.4/A12
AUX Memory P2.5/A13
(768 bytes) P2.6/A14
P2.7/A15
P3.1/TXD Full-duplex P1.0/PWM0/T2
P3.0/RXD UART P1.1/PWM1/T2EX
P1.2/PWM2
Port 1 P1.3/PWM3
P3.4/T0 Timer 0 P1.4/PWM4
P3.5/T1 Timer 1 P1.5
P1.6
P1.0/ PWM0/T2 P1.7
P1.1 / PWM1/T2EX Timer2
P3.0/RXD
P3.2/INT0 P3.1/TXD
Interrupt
P3.3/INT1 Control P3.2/INT0
Port 3 P3.3/INT1
P3.4/T0
P4.0/ ADC0 P3.5/T1
P4.1/ ADC1 P3.6/WR
P4.2 /ADC2 P3.7/ RD
P4.3/ ADC3 6-bit ADC
P4.4 /ADC4 P4.0/ ADC0
P4.5/ ADC5 P4.1/ADC1
P4.2 /ADC2
P1.0 / PWM0/T2 Port 4 P4.3/ ADC3
P1.1 /PWM1/T2EX P4.4/ ADC4
P1.2/ PWM2 8-bit PWM P4.5/ADC5
P1.3/ PWM3 P4.6
P1.4/ PWM4 P4.7
Watchdog timer
RST Power-On-Reset
XTAL1
Low-voltage detection OSC
XTAL2
V1 2008 Jul 09 11
Syntek Semiconductors STK6032
4 PINNING INFORMATION
4.1 Pinning diagram(QFP44 package)
P1.1/PWM1/T2EX
P1.0/PWM0/T2
P1.4/PWM4
P1.3/PWM3
P1.2/PWM2
P4.2/ADC2
P0.0/AD0
P0.1/AD1
P0.2/AD2
P0.3/AD3
VDD
44
43
42
41
40
39
38
37
36
35
34
P1.5 1 33 P0.4/AD4
P1.6 2 32 P0.5/AD5
P1.7 3 31 P0.6/AD6
RST 4 30 P0.7/AD7
P3.0/RXD/SCL 5
STK6032BQPG 29 EA
P4.3/ADC3 6 (QFP44) 28 P4.1/ADC1
P3.1/TXD/SDA 7 27 ALE
P3.2/INT0 8 26 PSEN
P3.3/INT1 9 25 P2.7/A15
P3.4/T0 10 24 P2.6/A14
P3.5/T1 11 23 P2.5/A13
12
13
14
15
16
17
18
19
20
21
22
P3.6/WR
P3.7/RD
XTAL22
XTAL1
VSS
P4.0/ADC0
P2.0/A8
P2.1/A9
P2.2/A10
P2.3/A11
P2.4/A12
V1 2008 Jul 09 12
Syntek Semiconductors STK6032
P1.1/PWM1/T2EX
P1.0/PWM0/T2
P1.4/PWM4
P1.3/PWM3
P1.2/PWM2
P4.4/ADC4
P4.2/ADC2
P0.0/AD0
P0.1/AD1
P0.2/AD2
P0.3/AD3
VDD
48
47
46
45
44
43
42
41
40
39
38
37
P1.5 1 36 P4.7
P1.6 2 35 P0.4/AD4
P1.7 3 34 P0.5/AD5
RST 4 33 P0.6/AD6
P3.0/RXD/SCL 5 STK6032BLQG 32 P0.7/AD7
P4.3/ADC3 6 31 EA
(LQFP48)
P3.1/TXD/SDA 7 30 P4.1/ADC1
P3.2/INT0 8 29 ALE
P3.3/INT1 9 28 PSEN
P3.4/T0 10 27 P2.7/A15
P3.5/T1 11 26 P2.6/A14
P4.5/ADC5 12 25 P2.5/A13
13
14
15
16
17
18
19
20
21
22
23
24
P4.6
P3.6/WR
P3.7/RD
XTAL22
XTAL1
VSS
P4.0/ADC0
P2.0/A8
P2.1/A9
P2.2/A10
P2.3/A11
P2.4/A12
V1 2008 Jul 09 13
Syntek Semiconductors STK6032
P1.1/PWM1/T2EX
P1.0/PWM0/T2
P1.4/PWM4
P1.3/PWM3
P1.2/PWM2
P4.2/ADC2
P0.0/AD0
P0.1/AD1
P0.2/AD2
P0.3/AD3
VDD
6
5
4
3
2
1
44
43
42
41
40
P1.5 7 39 P0.4/AD4
P1.6 8 38 P0.5/AD5
P1.7 9 37 P0.6/AD6
RST 10 36 P0.7/AD7
P3.0/RXD/SCL 11 STK6032BPLG 35 EA
P4.3/ADC3 12 (PLCC44) 34 P4.1/ADC1
P3.1/TXD/SDA 13 33 ALE
P3.2/INT0 14 32 PSEN
P3.3/INT1 15 31 P2.7/A15
P3.4/T0 16 30 P2.6/A14
P3.5/T1 17 29 P2.5/A13
18
19
20
21
22
23
24
25
26
27
28
P3.6/WR
P3.7/RD
XTAL2
XTAL1
VSS
P4.0/ADC0
P2.0/A8
P2.1/A9
P2.2/A10
P2.3/A11
P2.4/A12
V1 2008 Jul 09 14
Syntek Semiconductors STK6032
V1 2008 Jul 09 15
Syntek Semiconductors STK6032
V1 2008 Jul 09 16
Syntek Semiconductors STK6032
5.1 Filtering
Primary attention has been paid to the reduction of electromagnetic emission in the design of the STK6032. For example,
the internal clock routing has been carefully arranged and internal decoupling capacitance has been added. However, in
application, it is recommended that external capacitors should be connected across VDD and VSS pins. Lead length
should be as short as possible. Ceramic chip capacitors are recommended (100 nF).
V1 2008 Jul 09 17
Syntek Semiconductors STK6032
XTAL1
multiplexer
divided by 3 CPU CLK
CPUCLK
CPURATE
0 1 CPU CLK=XTAL1/3.
1 1 CPU CLK=XTAL1/3.
1 0 CPU CLK=XTAL1X2.
The Chip Configuration Register (SFR CHIPCON, at SFR map address BF hex) controls the following:
• Enable or disable the on-chip AUX memory access,
• Enable or disable of the ALE output,
• Selection of CPU clock, and
• Enable or disable of low-power reset.
V1 2008 Jul 09 18
Syntek Semiconductors STK6032
1 2 3 4 5 6 7 8 9
CPU CLK
cpu cycle C1 C2 C3 C4 C1 C2 C3 C4 C1
ALE
V1 2008 Jul 09 19
Syntek Semiconductors STK6032
PROGRAM STATUS WORD (SFR PSW), LOCATED AT D0H OF THE SFR MAP
Bit Address Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0
Mnemonics CY AC F0 RS1 RS0 OV F1 P
V1 2008 Jul 09 20
Syntek Semiconductors STK6032
7 MEMORY ORGANIZATION
The STK6032 has 4 blocks of on-chip memories. These are:
• 65536 bytes of flash program memory,
• 256 bytes of Main Data Memory,
• 768 bytes of AUX memory, and
• 46 bytes of Special Function Register.
The following diagram shows the overall memory spaces available in the microcontroller.
(1) The memory areas shown with dash lines are not
implemented on-chip. 65535
65535 65535
(2) The area drawn for each memory block is not
FFFF(hex)
proportional
l to its physical size.
768
767
Internal
Main RAM AUX RAM
255
128 bytes SFR (on-chip)
128
127 53 bytes
128 bytes (on-chip)
0 0 0
(on-chip)
V1 2008 Jul 09 21
Syntek Semiconductors STK6032
Address=65535 Address=65535
(FFFFh) (FFFFh)
Internal External
( EA= 1 ) (EA= 0 )
Address=0 Address=0
V1 2008 Jul 09 22
Syntek Semiconductors STK6032
Direct RAM
FF(hex) Direct addressing
only
upper SFR
128 bytes
30h
2Fh
80(hex)
Bit-Addressable 7F(hex)
Registers
Direct or indirect
lower
addressing
20h 128 bytes
1Fh
Bank 3
18h 00(hex)
17h
10h
Bank 2
0Fh Main Data RAM
Bank 1
08h
07h
Bank 0
00h
PSW SFR
Bit 4 Bit 3 selected bank
1 1 3
1 0 2
0 1 1
Fig.9 Main Data Memory and SFRs
0 0 0
V1 2008 Jul 09 23
Syntek Semiconductors STK6032
65535
Externally
Total AUX Memory Space
768
767
on-chip
AUX memory
0 Fig.10 The AUX Memory Spae
7.3.3 DUAL DATA POINTER (DATA POINTER 0 AND DATA POINTER 1) AND DPTR SELECT REGISTER (SFR DPS)
The STK6032 has two data pointers, Data Pointer 0 and Data Pointer 1. Data Pointer 0 is the traditional 8051 data pointer
for MOVX instrucitons. Data Pointer 1 is an extra data pointer for fast moving a block of data. Before executing a MOVX
instruction, an active data pointer must be selected by programming the Data Pointer Select Register (SFR DPS). Please
refer to Table 7 for detailed description of SFR DPS.
V1 2008 Jul 09 24
Syntek Semiconductors STK6032
All DPTR-related instrucitons use the currently selected data pointer. To switch the active pointer, toggle the SEL bit, by
use of the instruciton INC DPS. The 6 instructions that use the DPTR are given in the following table. An active DPTR
must be selected before executing these intructions.
7.3.4 STRETCH MEMORY CYCLES FOR ACCESSING EXTERNAL AUX MEMORY AND CLOCK CONTROL REGISTER
By default (after a reset), the MOVX instruction is executed in 3 instruciton cycles. However, it is possible to shorten or
lengthen, dynamically by user program, the instruction cycles needed to execute a MOVX instruction, by use of the M2,
M1, and M0 bits of the Clock Control Register (SFR CKCON).
The added extra cycles affects the width of the read/write strobe and all related timing. Using a higher stretch value
results in a wider read/write strobe, which then allows the memory more time to respond.
Table 9 and Table 10 give decription of the Clock Control Register and Table 11 gives decription about the stretched
cycles for various values of M2, M1, and M0.
V1 2008 Jul 09 25
Syntek Semiconductors STK6032
V1 2008 Jul 09 26
Syntek Semiconductors STK6032
V1 2008 Jul 09 27
Syntek Semiconductors STK6032
V1 2008 Jul 09 28
Syntek Semiconductors STK6032
Address RESET
BLOCK SYMBOL NAME
(Hex format) VALUE
CPU ACC Accumulator. E0 0000 0000
B B register F0 0000 0000
SP Stack Pointer 81 0000 0111
DPL0 Data Pointer 0, Low byte 82 0000 0000
DPH0 Data Pointer 0, High byte 83 0000 0000
DPL1 Data Pointer 1, Low byte 84 0000 0000
DPH1 Data Pointer 1, High byte 85 0000 0000
DPS Selection for active Data Pointer 86 0000 0000
PCON Power Control Register 87 0011 0000
PSW Program Status Word D0 0000 0000
CHIPCON Chip Configuration Register BF xxx1 0000
CKCON Clock Control Register 8E 0000 0001
Interrupt System IE Interrupt Enable Register A8 0000 0000
IP Interrupt Priority Register B8 x000 0000
Ports P0 Port 0 latch 80 1111 1111
P0_OPT Port 0 pin option for I/O or external memory DD 1111 1111
access
P1 Port 1 latch 90 1111 1111
P1_OPT Port 1 pin option for I/O or PWM outputs D1 xxx0 0000
P2 Port 2 A0 1111 1111
P2_OPT Port 2 pin option for I/O or external memory DE 1111 1111
access
P3 Port 3 latch B0 1111 1111
P4 Port 4 latch C0 1111 1111
P4_OPT Port 4 pin option for I/O or ADC inputs D9 xx00 0000
UART SBUF0 Serial Port Buffer Register 99 ???? ????
SCON0 Serial Port Control/Status Register 98 0000 0000
Timer 0 / Time 1 TCON Timer 0/1 Control Register 88 0000 0000
TMOD Timer 0/1 Mode Register 89 0000 0000
TL0 Timer 0, Low byte 8A 0000 0000
TL1 Timer 1, Low byte 8B 0000 0000
TH0 Timer 0, High byte 8C 0000 0000
TH1 Timer 1, High byte 8D 0000 0000
CKCON Clock Control Register 8E 0000 0001
Timer 2 T2CON Timer 2 Control Register C8 0000 0000
RCAP2L Timer 2 Reload Capture Register, Low byte CA 0000 0000
RCAP2H Timer 2 Reload Capture Register, High byte CB 0000 0000
TL2 Timer 2, Low byte CC 0000 0000
TH2 Timer 2, High byte CD 0000 0000
CKCON Clock Control Register 8E 0000 0001
V1 2008 Jul 09 29
Syntek Semiconductors STK6032
Address RESET
BLOCK SYMBOL NAME
(Hex format) VALUE
Watchdog Timer WDT Watchdog Timer Control Register E1 00xx x000
PWM P1_OTP Port 1 pin selection for PWM outputs D1 xxx0 0000
PWM0D PWM0 width D2 1000 0000
PWM1D PWM1 width D3 1000 0000
PWM2D PWM2 width D4 1000 0000
PWM3D PWM3 width D5 1000 0000
PWM4D PWM4 width D6 1000 0000
P4_OPT Selet Port 4 pin function D9 xxxx 0000
ADC ADCSEL Select ADC input channel for conversion DA 0xxx 0000
ADCVAL Buffer for converted ADC value. DB xx00 0000
ISP ISPSLV ISP Control slave address E2 0000 0000
ISPEN Write 93 (hex) to enable the ISP mode E3 0000 0000
V1 2008 Jul 09 30
Syntek Semiconductors STK6032
9.2 Port 0
Port 0 pins are push-pull outputs. It has three functions:
• Pure bidirectional I/O data ports
• Low-byte address (A0 ~ A7) output and OP code input, when executing program in external program ROM mode
(EA= 0, during power-on reset).
• Low-byte address (A0 ~ A7) and data bus during read/write to off-chip AUX memory.
SFR P0_OPT must be properly programmed to ensure proper operation of Port 0.
Output_enable
Port 0 pins are push-pull
Data_out outputs. The output
Output
sinking and sourcing
capability is 4 mA (typ.).
Input_enable
Data_in
Fig.11 Port 0 schematic
VDD
Pins of Port 1, Port 2, and
Port 3 are push-pull outputs
Pull-up
with weak internal pull-up. The
output sinking and sourcing
Output_enable
capability is 4 mA (typ.). The
typical value of the equivalent
Data_out Output resistance of the pull-up PMOS
is 15K ohm.
Input_enable
Data_in
Fig.12 Schematic of Port 1, Port 2, and Port 3
V1 2008 Jul 09 31
Syntek Semiconductors STK6032
9.4 Port 4
Port 4 is an 8-bit port. It shares inputs with the 6-bit ADC. SFR P4_OPT needs to be programmed to select
P4.0 - P4.5 pins as general-purpose I/O pins or ADC input pins. Please refer to Section 20.3.1 for more description of
Port 4.
Output_enable
Data_out Output
Input_enable
Data_in
Analog_In
ESD
V1 2008 Jul 09 32
Syntek Semiconductors STK6032
10 TIMER/COUNTER 0, TIMER/COUNTER 1
MSB LSB
Gate C/T M1 M0 Gate C/T M1 M0
Timer 1 Timer 0
TIMER 0/1 MODE REGISTER (TMOD), LOCATED AT 89H OF THE SFR SPACE
Bit Address TMOD.7 TMOD.6 TMOD.5 TMOD.4 TMOD.3 TMOD.2 TMOD.1 TMOD.0
Mnemonics Gate C/T M1 M0 Gate C/T M1 M0
(Timer1) (Timer1) (Timer1) (Timer1) (Timer0) (Timer0) (Timer0) (Timer 0)
V1 2008 Jul 09 33
Syntek Semiconductors STK6032
10.3 Timer 0/1 Control Register (SFR TCON at 88 H of the SFR space)
V1 2008 Jul 09 34
Syntek Semiconductors STK6032
BIT
MNEMONIC FUNCTION
POSITION
TF1 TCON.7 Timer 1 overflow flag.
Set by hardware on Timer/Counter 1 overflow.
Cleared by hardware when processor vectors to interrupt routine, or clearing the bit in
software.
TR1 TCON.6 Timer 1 Run control bit.
Set/cleared by software to turn Timer/Counter on/off.
TF0 TCON.5 Timer 0 overflow flag.
Set by hardware on Timer/Counter 0 overflow.
Cleared by hardware when processor vectors to interrupt routine, or clearing the bit in
software.
TR0 TCON.4 Timer 0 Run control bit.
Set/cleared by software to turn Timer/Counter on/off.
IE1 TCON.3 External Interrupt 1 Flag.
Set by hardware when external interrupt 1 is detected.
This bit is cleared after the interrupt is processed. That is, when the Return from Interrupt
instruction is executed.
IT1 TCON.2 Interrupt 1 Type Control bit.
Set/cleared by software to specify falling edge/low level triggered external interrupt.
IE0 TCON.1 External Interrupt 0 Flag.
Set by hardware when external interrupt 0 is detected.
This bit is cleared after the interrupt is processed. That is, when the Return from Interrupt
instruction is executed.
IT0 TCON.0 Interrupt 0 Type Control bit.
Set/cleared by software to specify falling edge/low level triggered external interrupt.
10.4 Clock Control Register, SFR CKCON, at address 8E hex of the SFR map
For a description of the Clock Control Regsiter, please refer to Table 9 and Table 10.
V1 2008 Jul 09 35
Syntek Semiconductors STK6032
T0M=1 T1M=1
Divide-by-4
bit 0
bit 1
bit 2
bit 3
bit 4
bit 5
bit 6
bit 7
P35/T1 Pin
C/T=1
(TMOD.5, TMOD.4)=00
TR1
(TCON.6)
Enable (TMOD.5, TMOD.4)=01
Gate
(TMOD.7) overflow flag
Interrupt
bit 0
bit 1
bit 2
bit 3
bit 4
bit 5
bit 6
bit 7
P3.3/INT1 Pin TF1
SFR TH1 (TCON.7)
P3.4/T0 Pin
C/T=1
(TMOD.1, TMOD.0)=00
Mode0
TR0
(TCON.4) Enable
(TMOD.1, TMOD.0)=01
Gate
(TMOD.3) overflow flag
Interrupt
bit 0
bit 1
bit 2
bit 3
bit 4
bit 5
bit 6
bit 7
In this mode, the Timer 0/Timer 1 registers are configured as a 13-bit register, which is composed of all the 8 bits of the
TH1 (TH0) and the lower 5 bits of TL1 (TL0). The upper 3 bits of the TL1 (TL0) are indeterminate. The Timer Interrupt
flag TF1 (TF0) is set to HIGH when the 13-bit register, acting as a counter, rolls over from all 1s to all 0s.
The 13-bit register(counter) is enabled only under the following conditions:
1. TR0 (TR1)=1, and
2. Either Gate=0 or INT1 (INT0)=1.
V1 2008 Jul 09 36
Syntek Semiconductors STK6032
T0M=1 T1M=1
Divide-by-4
TR1 Reload
(TCON.6)
Enable
bit 0
bit 1
bit 2
bit 3
bit 4
bit 5
bit 6
bit 7
Gate
(TMOD.7)
P3.3/INT1 Pin SFR TH1
TR0 Reload
(TCON.4) Enable
bit 0
bit 1
bit 2
bit 3
bit 4
bit 5
bit 6
bit 7
Gate
(TMOD.3)
SFR TH0
P3.2/INT0 Pin
V1 2008 Jul 09 37
Syntek Semiconductors STK6032
T0M=1
Divide-by-4
SFR TH0 overflow flag
Interrupt
bit 0
bit 1
bit 2
bit 3
bit 4
bit 5
bit 6
bit 7
TF1
TR1
(TCON.6) (TCON.7)
TR0
(TCON.4) Enable
Gate
(TMOD.3)
P3.2/INT0 Pin
V1 2008 Jul 09 38
Syntek Semiconductors STK6032
11 RESET
Low-voltage
detection and reset
Power-on-reset
external
resistor
V1 2008 Jul 09 39
Syntek Semiconductors STK6032
POR Pulse
Internal
Reset
Oscillator
V1 2008 Jul 09 40
Syntek Semiconductors STK6032
12 TIMER/COUNTER 2
V1 2008 Jul 09 41
Syntek Semiconductors STK6032
VALUE AFTER
ADDRESS R/W MNEMONICS DESCRIPTION
RESET
Select clock frequency for Timer 0, Timer 1, and Timer 2, 0000 0000
8E R/W CKCON
and memory stretch cycle for the MOVX instruciton.
C8 R/W T2CON Timer 2 Control Register ( bit-addressable ) 0000 0000
C9 R/W T2MOD Timer 2 Mode Control register xxxx xx 0x
CA R/W RCAP2L Timer 2 Reload/Capture Register, Low byte 0000 0000
CB R/W RCAP2H Timer 2 Reload/Capture Register, High byte 0000 0000
CC R/W TL2 Timer 2, Low byte 0000 0000
CD R/W TH2 Timer 2, High byte 0000 0000
V1 2008 Jul 09 42
Syntek Semiconductors STK6032
BIT
MNEMONIC FUNCTION
POSITION
Timer 2 overflow flag.
• This bit is set to HIGH when Timer 2 overflows from FFFF(hex) to 0000(hex). It must
be cleared by software.
TF2 T2CON.7
• TF2 will not be set when either RCLK or TCLK is 1. That is, when Timer 2 is in Baud
Rate Generator mode, TF2 will never be set.
• Writing a 1 to TF2 bit forces a Timer 2 interrupt, if this interrupt function is enabled.
Timer 2 External flag.
• This bit is set to HIGH when a capture or reload action is triggered by a high-to-low
transition on the T2EX input pin and when EXEN2=1.
EXF2 T2CON.6
• When Timer 2 interrupt is enabled, EXF2 = 1 will cause the CPU to jump to Timer 2
interrupt subroutine. It must be cleared by software.
• Writing a 1 to the EXF2 bit forces a Timer 2 interrupt, if it is enabled.
UART Receiver clock selection.
This bit is used to select the receiver clock of the UART.
RCLK T2CON.5 • If this bit is programmed to 1 (RCLK=1), UART uses Timer 2 overflow pulses as its
receiver clock in Modes 1 and 3.
• If this bit is programmed to 0 (RCLK=0) , UART uses Timer 1 overflow pulses as its
receiver clock.
UART Transmitter clock selection.
This bit is used to select the transmitter clock of the UART.
TCLK T2CON.4 • If this bit is programmed to 1 (TCLK=1), UART uses Timer 2 overflow pulses as its
transmitter clock in Modes 1 and 3.
• If this bit is programmed to 1 (TCLK=0) , UART uses Timer 1 overflow pulses as its
transmitter clock.
Timer 2 external enable.
EXEN2 T2CON.3 • EXEN2=1 allows a capture or reload to occur as a result of a high-to-low transition on
the T2EX input, if Timer 2 is not in baud rate generator mode.
• EXEN2=0 causes Timer 2 to ignore all events at T2EX input.
V1 2008 Jul 09 43
Syntek Semiconductors STK6032
BIT
MNEMONIC FUNCTION
POSITION
Start/Stop control for Timer 2.
TR2 T2CON.2 • TR2=1 allows clocks to be added to Timer 2.
• TR2=0 prevent clocks from being added to Timer 2.
Select timer function or counter function of Timer 2.
• C/T2= 0 selects the timer fucntion.
• When used as a timer, Timer 2 runs at four XTAL1 clocks per increment or twelve
XTAL1 clocks per increment, as selected by the T2M bit (CKCON.5) of the SFR
C/T2 T2CON.1 CKCON, in all modes except baud rate generator mode.
• When used in baud rate generator mode, Timer 2 runs at two XTAL1 per increment,
independent of the state of the T2M bit.
• C/T2=1 selects the external event counter function; falling-edge-triggered on the T2
input.
CP/RL2 T2CON.0 Selection of capture or reload function.
• When this bit is programmed to HIGH (CP/RL2 =1), Timer 2 is in capture mode and
capture occurs on a high-to-low transitions (falling edge) at T2EX, if EXEN2=1.
• When this bit is programmed to LOW (CP/RL2 =0), Timer 2 is in auto-reload mode
and auto-reload occurs either with Timer 2 overflows or a high-to-low transitions at
T2EX when EXEN2=1.
• When RCLK=1 or TCLK=1, this bit is ignored and the timer is forced to auto-reload on
a Timer 2 overflow.
V1 2008 Jul 09 44
Syntek Semiconductors STK6032
Timer 2 Control Register ( SFR T2CON ), located at C8(hex) of the SFR memory space.
Bit Address Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0
Mnemonics T2OE
Reset Value X X X X X X 0 X
BIT
MNEMONIC FUNCTION
POSITION
T2OE T2MOD.1 Timer 2 output enable bit.
Programming this bit to HIGH (T2OE=1) enables Timer 2 overflow pulse to be sent to
the P1.0/PWM0/T2 pin, as illustrated in the following figure.
P1.0/PWM0/T2
pin
Clock overflow pulse P1.0/PWM0/T2
Timer 2
Control
T2OE
Bit PWM0E
of SFR P1_OPT
V1 2008 Jul 09 45
Syntek Semiconductors STK6032
XTAL1 Divide-by-12
T2M=0 (CKCON.5)
T2M=1
Divide-by-4 C/T2=0
TR2
falling-edge C/T2=1 (T2CON.2)
P1.0/PWM0/T2 Pin detection
Timer 2 clock
To Pin1.0
TF2 (T2MOD.1=1)
(T2CON.7)
Timer 2
capture interrupt
This portion of circuit external flag
bit 0
bit 1
bit 2
bit 3
bit 4
bit 5
bit 6
bit 7
bit 0
bit 1
bit 2
bit 3
bit 4
bit 5
bit 6
bit 7
is ignored. EXF2
(T2CON.6)
SFR RCAP2L SFR RCAP2H
P1.1/PWM1/T2EX Pin
falling-edge
detection
EXEN2
(T2CON.3)
CP/RL2
(T2CON.0)
V1 2008 Jul 09 46
Syntek Semiconductors STK6032
XTAL1 Divide-by-12
T2M=0 (CKCON.5)
T2M=1
Divide-by-4 C/T2=0
TR2
falling-edge C/T2=1 (T2CON.2)
P1.0/PWM0/T2 Pin detection
Timer 2 clock
To Pin1.0
TF2 (T2MOD.1=1)
(T2CON.7)
Timer 2
capture interrupt
external flag
bit 0
bit 1
bit 2
bit 3
bit 4
bit 5
bit 6
bit 7
bit 0
bit 1
bit 2
bit 3
bit 4
bit 5
bit 6
bit 7
EXF2
(T2CON.6)
SFR RCAP2L SFR RCAP2H
P1.1/PWM1/T2EX Pin
falling-edge
Capture/Reload
detection
Selection
EXEN2
(T2CON.3)
CP/RL2 =1
(T2CON.0)
V1 2008 Jul 09 47
Syntek Semiconductors STK6032
XTAL1 Divide-by-12
T2M=0 (CKCON.5)
T2M=1
Divide-by-4 C/T2=0
To Pin1.0
P1.0/PWM0/T2 Pin C/T2=1
T2OE
(T2MOD.1=1)
TF2
TR2
(T2CON.2) Timer 2
interrupt
Reload
bit 0
bit 1
bit 2
bit 3
bit 4
bit 5
bit 6
bit 7
bit 0
bit 1
bit 2
bit 3
bit 4
bit 5
bit 6
bit 7
EXF2
SFR RCAP2H external flag
SFR RCAP2L
(T2CON.6)
P1.1/PWM1/T2EX Pin
falling-edge
detection Capture/Reload
Selection
EXEN2
(T2CON.3)
CP/RL2=0
(T2CON.0)
V1 2008 Jul 09 48
Syntek Semiconductors STK6032
f ( XTAL1 )
Baud Rate = Timer 2 overflow rate
-------------------------------------------------------- = -------------------------------------------------------------------------------------------------------- Equation (1)
16 ( 32 ) × [ 65536 – ( RCAP2H ;RCAP2L ) ]
In the above equation, (RCAP2H ; RCAP2L) is the content of registers RCAP2H and RCAP2L taken as a 16-bit unsigned
integer. The 32 in the denominator is the result of the XTAL1 clock being divided by 2 and the Timer 2 overflow rate being
divided by 16. Setting TCLK=1 or RCLK=1 automatically causes the XTAL1 clock to be divided 2.
12.6.1 CALCULATING THE VALUE OF RCAP2H AND RCAP2L FOR A DESIRED BAUD RATE
If a programmer has decided to use a certain baud rate, the required value of RCAP2H and RCAP2L and be derived
from Equation (2), which is re-manipulated from the Equation (1).
XTAL1
( RCAP2H, RCAP2L ) = 65536 – ----------------------------------------- Equation (2)
32 × Baudrate
Table 26 gives calculated value of RCAP2H and RCAP2L for some desired baud rates.
Table 26 Timer 2 reload value for UART Mode 1 and Mode 3 baud rate.
V1 2008 Jul 09 49
Syntek Semiconductors STK6032
V1 2008 Jul 09 50
Syntek Semiconductors STK6032
XTAL1 Divide-by-2
C/T2=0
Reload
bit 0
bit 1
bit 2
bit 3
bit 4
bit 5
bit 6
bit 7
bit 0
bit 1
bit 2
bit 3
bit 4
bit 5
bit 6
bit 7
SFR RCAP2L SFR RCAP2H
Timer1
overflow
1⁄2
0 1
SMOD0
RCLK (PCON.7)
1 0
P1.1/PWM1/T2EX Pin
falling-edge Timer 2
detection EXF2
interrupt
external flag
EXEN2 (T2CON.6)
(T2CON.3)
V1 2008 Jul 09 51
Syntek Semiconductors STK6032
13 OSCILLATOR
idle
CLK
stop
XTAL1 XTAL2
Note:
C1 C2
1. C1=C2=22P ceramic.
2. R=1M ohm.
XTAL1 is the high gain amplifier input, and XTAL2 is the output. To drive the STK6032 externally, XTAL1 is driven from
an external clock source and XTAL2 is left open.
V1 2008 Jul 09 52
Syntek Semiconductors STK6032
14 INTERRUPTS
Source Interrupt sources Flags generated Interrupt Interrupt Priority within Vector
number by the interrupt enable bit priority bit level Address
1 External Interrupt 0 IE0 (TCON.1) EX0 (IE.0) PX0 (IP.0) 1 (the highest) 0003H
2 Timer 0 Overflow TF0 (TCON.5) ET0 (IE.1) PT0 (IP.1) 2 000BH
3 External Interrupt 1 IE1 (TCON.3) EX1 (IE.2) PX1 (IP.2) 3 0013H
4 Timer 1 Overflow TF1 (TCON.7) ET1 (IE.3) PT1 (IP.3) 4 001BH
5 UART Interrupt TI (SCON0.1) ES (IE.4) PS (IP.4) 5 0023H
(UART receive or RI (SCON0.0)
transmit)
6 Timer 2 overflow TF2 (T2CON.7) EX2 (IE.5) PT2 (IP.5) 6 002BH
T2EX pin EXF2 (T2CON.6)
Note:
1. Because Timer2 overflow and T2EX share the same interrupt vector address 002BH, it is the responsibility of
software programmer to check individual interrupt flag to see which one caused the interrupt.
V1 2008 Jul 09 53
Syntek Semiconductors STK6032
V1 2008 Jul 09 54
Syntek Semiconductors STK6032
SFR Interrupt Priority Register ( SFR IP ), located at B8 hex of the SFR map
Bit Address Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0
Mnemonics PT2 PS0 PT1 PX1 PT0 PX0
Reset value 1 0 0 0 0 0 0 0
V1 2008 Jul 09 55
Syntek Semiconductors STK6032
High
Priority
Timer0 Overflow TF0
TCON.5 ET0 PT0
IE.1 IP.1 Low
Priority
Timer1 Overflow TF1
TCON.7 ET1 PT1
IE.3 IP.3
Timer2 overflow TF2
T2CON.7 OR
P1.1/PWM1/T2EX
EXF2
T2CON.6 EX2 PX2
EXEN2
IE.5 IP.5
T2CON.3
RI
UART SCON0.0 OR
TI ES PS
SCON0.1 IE.4 IP.4
P3.2/INT0
IE0
IT0 TCON.1 EX0 PX0
TCON.0 IE.0 IP.0
P3.3/INT1
IE1
TCON.3 EX1 PX1
TCON.2 IP.2
IE.7
= Low-level-triggered
= Falling-edge-triggered
V1 2008 Jul 09 56
Syntek Semiconductors STK6032
16 UART0
Transmit Register
physical path Receive Register
V1 2008 Jul 09 57
Syntek Semiconductors STK6032
V1 2008 Jul 09 58
Syntek Semiconductors STK6032
Table 33 Serial Port Control and Status Register (SFR SCON0, 98h)
Bit Address Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0
Mnemonics SM0 SM1 SM2 REN0 TB8 RB8 TI0 RI0
RI0 SCON0.0 In mode 1, this bit is set to logic 1 after the last sampling of the stop bit, subject to the
state of SM2.
In mode 2, and mode 3, this bit is set to a logic 1 by hardware at the last sampling of the
stop bit.
V1 2008 Jul 09 59
Syntek Semiconductors STK6032
16.4 Mode 0
Write to
SFR BUF0
P3.1/TXD
P3.0/ RXD D0 D1 D2 D3 D4 D5 D6 D7
TI0
Write to
SFR BUF0
P3.1/TXD
P3.0/RXD D0 D1 D2 D3 D4 D5 D6 D7
RI0
V1 2008 Jul 09 60
Syntek Semiconductors STK6032
16.5 Mode 1
START D0 D1 D2 D3 D4 D5 D6 D7 STOP
TX CLK
always high
P3.0/RXD
TI0
V1 2008 Jul 09 61
Syntek Semiconductors STK6032
RX CLK
(baud rate)
Bit sampling
RI0
V1 2008 Jul 09 62
Syntek Semiconductors STK6032
16.6 Mode 2
V1 2008 Jul 09 63
Syntek Semiconductors STK6032
Write to
SFR BUF0
TX CLK
TI0
V1 2008 Jul 09 64
Syntek Semiconductors STK6032
RX CLK
Bit sampling
RI0
V1 2008 Jul 09 65
Syntek Semiconductors STK6032
16.7 Mode 3
V1 2008 Jul 09 66
Syntek Semiconductors STK6032
SMOD
2
Baud rate = ----------------------
32
× Timer1 overflow rate
SMOD
2 1
Baud rate = --------------------- × XTAL1 × ----------------------------------------------------
32 [ 12 × ( 256 – TH1 ) ]
By programming Timer 1 to run as a 16-bit timer (high nibble of TMOD=0001B), and using the Timer 1 interrupt to do a
16-bit software reload, very low baud rate can be achieved
Table 35 lists sample reload values for a variety of common serial port baud rate.
V1 2008 Jul 09 67
Syntek Semiconductors STK6032
Table 35 Timer 1 reload value for UART0 Mode 1 and Mode 3 baud rate.
V1 2008 Jul 09 68
Syntek Semiconductors STK6032
1 2 3 4 5 6 7 8 9
D0 D1 D2 D3 D4 D5 D6 D7 address/
START data STOP
TX RX TX RX TX RX TX RX
1. Enable all slave receivers for reception by setting REN=1 and clearing RI=0.
2. Setting SM2=1 for all slave receivers. SM=1 indicates that only an address byte, which has its 9th data bit set to
HIGH, can be received by all slave receivers.
3. The master transmitter broadcasts an address byte out.
4. All the UART0s of all slave receivers receive this address byte and interrupt their respective CPU.
5. All slave receivers execute their UART0 interrupt subroutine.
6. In the interrupt subroutine, the received address is compared with the slave’s pre-assigned address. If the two
addresses match, then the SM2 bit is cleared to LOW. SM2=LOW indicates that the 9th bit data bit can be LOW or
HIGH. That is, the addressed slave can always receive next transmitted data bytes from the master transmitter.
7. If the received address does not match with the slave’s own pre-assigned address, the slave keeps its SM2 bit set
to HIGH, indicating that the slave will not be able to received the next transmitted data bytes.
8. A communication channel is therefore established between the master transmitter and the addressed slave receiver.
The master can continue to send data bytes to the addressed slave receiver. All other un-addressed slave receivers
can not receive the following data bytes, because their SM2 bits remain at HIGH.
9. Once the entire message has been received, the addressed slave sets its SM2 bit to HIGH to block further interrupt
and waits for the next address byte.
V1 2008 Jul 09 69
Syntek Semiconductors STK6032
17 POWER-SAVING MODES
The STK6032 provides two power-saving modes: Idle mode and Stop mode. The bits that control entry into Idle mode
and Stop modes are bits 0 (Idle mode) and bit 1 (Stop mode) of the Power Control Register (SFR PCON) at SFR
adddress 87(hex). Table 36 gives a description of the Power Control Register (SFR PCON).
Table 36 Power Control Register, SFR PCON at address 87(hex) of the SFR map
Bit Mnemonics Function
PCON.7 SMOD0 UART baud-rate doubler enable.
When SMOD0=1, the baud rate for the UART is doubled.
PCON. 6~4 Reserved.
PCON.3 GF1 General purpose flag 1.
Bit-addressable, general-purpose flag for software control.
PCON.2 GF0 General purpose flag 0.
Bit-addressable, general-purpose flag for software control.
PCON.1 STOP STOP mode select.
Setting the STOP=1 places the STK6032 in STOP mode.
PCON.0 IDLE IDLE mode select.
Setting the IDLE=1 places the STK6032 in IDLE mode.
If the STOP Mode and the Idle Mode are selected at the same time, the STOP Mode has higher priority, as can be
obviously seen in Fig.37
XTAL2 XTAL1
OSC
interrupts,
Clock
serial port,
timers
Generator
CPU
STOP
IDLE
Fig.37 Power-saving modes.
V1 2008 Jul 09 70
Syntek Semiconductors STK6032
• External/Internal interrupts
• External reset or power-on-reset.
The instruction that sets PCON.0 (=1) is the last instruction executed in the normal operating mode before Idle mode is
activated.
Once in the Idle mode, the CPU status is preserved in its entirety: the Stack Pointer, Program Counter, Program Status
Word, Accumulator, RAM and all other registers maintain their current data during Idle mode. The status of external pins
during Idle mode is shown in Table 37.
There are three ways to terminate the Idle mode:
• Activation of any enabled interrupt from interrupt sources listed in Table 27 will cause PCON.0 to be cleared by
hardware, terminating Idle mode, but only if there is no interrupt in service with the same or higher priority. The interrupt
is serviced, and following return from interrupt instruction RETI, the next instruction to be executed will be the one
which follows the instruction that wrote a logic 1 to PCON.0.
The flag bits GF0 and GF1 may be used to determine whether the interrupt was received during normal execution or
during Idle mode.
For example, the instruction that writes to PCON.0 can also set or clear one or both flag bits.
When Idle mode is terminated by an interrupt, the service routine can examine the status of the flag bits.
• The second way of terminating the Idle mode is with an external hardware reset. Since the oscillator is still running,
the hardware reset is required to be active for two instruction cycles to complete the reset operation.
• The third way of terminating the Idle mode is by internal watchdog reset.
V1 2008 Jul 09 71
Syntek Semiconductors STK6032
V1 2008 Jul 09 72
Syntek Semiconductors STK6032
18 WATCHDOG TIMER
XTAL1
multiplexer
divided by 3 CPU CLK
X2
CPUCLK
CPURATE
÷ 256 3-bit
÷ 10000 Programmable RESET
Counter
CPU CLK
WDT0
EWDT WDTCLR
WDT1
WDT2
Assuming that XTAL1= 24 MHz and CPU CLK is programmed to be equal to XTAL1,
then the Watchdog Timer overflow period ∆t can be calculated from the following
equation. Please also refer to Table 40.
1
∆t = N × ------------ × 256 × 10000
24M
V1 2008 Jul 09 73
Syntek Semiconductors STK6032
MNEMONIC FUNCTION
EWDT (bit 7) Enable Watchdog Timer.
Setting EWDT=1 enables the Watchdog Timer. Setting EWDT=0 disables the Watchdog Timer.
WDTCLR (bit 6) Setting WDTCLR= 1 clears the Watchdog Timer Programmable Counter and the
divided-by-10000 prescaler.
The Watchdog Timer must be regularly cleared before it overflows.
WDT2, WDT1, These 3 bits decides the overflow period of the Watchdog Timer. The following table gives the
WDT0 (bits 2, 1, 0) overflow period versus the values of these 3 bits, assuming that XTAL1=24 MHz and CPU CLK
is programmed to be equal to XTAL1.
V1 2008 Jul 09 74
Syntek Semiconductors STK6032
Address(Hex
SYMBOL DESCRIPTION RESET VALUE
format)
P1_OTP Port 1 pin selection for PWM output or Port 1 one pin output. D1 xxx0 0000
PWM0D PWM0 width D2 1000 0000
PWM1D PWM1 width D3 1000 0000
PWM2D PWM2 width D4 1000 0000
PWM3D PWM3 width D5 1000 0000
PWM4D PWM4 width D6 1000 0000
When a PWM register (PWM0D ~ PWM4D) is loaded with a new value, the associated output is updated immediately. It
does not have to wait until the end of the current counter period. All PWMn output pins are driven by push-pull output
drivers.
V1 2008 Jul 09 75
Syntek Semiconductors STK6032
P1.0/PWM0
8-bit comparator output port
8-bit counter
P1.1/PWM1
8-bit comparator output port
8-bit counter
CPU_CLK P1.2/PWM2
Divided by 256 8-bit comparator output port
8-bit counter
P1.3/PWM3
8-bit comparator output port
8-bit counter
P1.4/PWM4
8-bit comparator output port
8-bit counter
V1 2008 Jul 09 76
Syntek Semiconductors STK6032
The value of a Pulse Width Register indicates the HIGH pulse width within an interval of 256 CPU clocks, as illustrated
in Fig.40.
PWM interval
PWM SFR=1
PWM SFR=254
programmed value
Fig.40 value of a PWM SFR and the pulse width
V1 2008 Jul 09 77
Syntek Semiconductors STK6032
P4.4/ADC4
P4.3/ADC3
SFR ADCSEL
SFR ADCVAL
SFR P4_OPT
P4.2/ADC2
6-bit ADC
P4.1/ADC1
P4.0/ADC0
V1 2008 Jul 09 78
Syntek Semiconductors STK6032
Bit Number BIT 7 BIT 6 BIT 5 BIT 5 BIT 3 BIT 2 BIT 1 BIT 0
Bit Name not implemented ADC5E ADC4E ADC3E ADC2E ADC1E ADC0E
Rest Value x x 0 0 0 0 0 0
V1 2008 Jul 09 79
Syntek Semiconductors STK6032
V1 2008 Jul 09 80
Syntek Semiconductors STK6032
70
60
50
40
30
20
10
0
0.03
0.34
0.64
0.95
1.25
1.56
1.87
2.18
2.49
2.8
3.11
3.42
3.73
4.04
4.35
4.66
V1 2008 Jul 09 81
Syntek Semiconductors STK6032
21 PIN CIRCUITS
Output_enable
Port 0 pins are push-pull
Data_out outputs. The output
Output
sinking and sourcing
capability is 4 mA (typ.).
Input_enable
Data_in
21.2 Port 1 (P1.0 ~ P1.7), Port 2 (P2.0 ~ P2.7), Port 3 (P3.0 ~ P3.7) circuit (Bidirectional I/O, with weak Pull-up)
VDD
Pins of Port 1, Port 2, and
Port 3 are push-pull outputs
Pull-up
with weak internal pull-up. The
output sinking and sourcing
Output_enable
capability is 4 mA (typ.). The
typical value of the equivalent
Data_out Output resistance of the pull-up PMOS
is 15K ohm.
Input_enable
Data_in
Data_out Output
V1 2008 Jul 09 82
Syntek Semiconductors STK6032
VDD
Note: This pin is weakly
pulled up.
Fig.46 EA pad
VDD
VSS
Fig.47 RST pad
STOP
XTAL2
Please refer to Fig.24 for
detail.
IDLE
CLK XTAL1
V1 2008 Jul 09 83
Syntek Semiconductors STK6032
Output_enable
Data_out Output
Input_enable
Data_in
Analog_In
ESD
V1 2008 Jul 09 84
Syntek Semiconductors STK6032
Notes
1. The following applies to the Absolute Maximum Ratings:
a) Stresses above those listed under Absolute Maximum Ratings may cause permanent damage to the device. This
is a stress rating only and functional operation of the device should refer to the normal DC and AC characteristics.
b) This product includes ESD-protection circuits, specifically designed for the protection of its internal circuit.
However, its suggested that conventional ESD precautions be taken.
c) Parameters are valid over operating temperature range unless otherwise specified. All voltages are with respect
to ground.
2. This value is based on the maximum allowable die temperature and the thermal resistance of the package, not on
device power consumption.
V1 2008 Jul 09 85
Syntek Semiconductors STK6032
23 DC/AC CHARACTERISTICS
Test condition: VDD = 5.0 V ±10%; VSS = 0 V; all voltages with respect to VSS , unless otherwise specified;
Tamb = -40 to +85 °C; fXTAL1 = 24 MHz.
V1 2008 Jul 09 86
Syntek Semiconductors STK6032
V1 2008 Jul 09 87
Syntek Semiconductors STK6032
1 2 3 4
CPU CLK
Memory address
ALE
PSEN
Note:
For external program ROM read, the EA input pin
must be conntected to LOW before Power-On-Reset.
26 INSTRUCTION SET
The STK6032’s instruction set is binary-code-compatible with industrial standard 80C51. It consists of 49 single byte,
45 two byte and 17 three byte instructions. Using a 16 MHz crystal, 64 of the instructions are executed in 200 ns, 45 in
375 ns and the multiply, divide instructions in 750 ns.
A summary of the instruction set is given in Table 54, Table 55, Table 56, Table 57 and Table 58.
FLAG(2)
INSTRUCTION
C OV AC
ADD X X X
ADDC X X X
SUBB X X X
MUL 0 X
DIV 0 X
DA X X
RRC X
RLC X
SETB C 1
CLR C 0
CPL C X
ANL C, bit X
ANL C,/bit X
ORL C, bit X
ORL C,/bit X
MOV C, bit X
CJNE X
Note
1. Note that operations on SFR byte address 208 or bit addresses 209 to 215 (i.e. the PSW or bits in the PSW) will also
affect flag settings.
2. X = dont care.
OPCODE
MNEMONIC DESCRIPTION BYTES CYCLES
(HEX)
Arithmetic operations
ADD A,Rr Add register to A 1 1 2*
ADD A,direct Add direct byte to A 2 2 25
ADD A,@Ri Add indirect RAM to A 1 1 26, 27
ADD A,#data Add immediate data to A 2 2 24
ADDC A,Rr Add register to A with carry flag 1 1 3*
ADDC A,direct Add direct byte to A with carry flag 2 2 35
ADDC A,@Ri Add indirect RAM to A with carry flag 1 1 36, 37
ADDC A,#data Add immediate data to A with carry flag 2 2 34
SUBB A,Rr Subtract register from A with borrow 1 1 9*
SUBB A,direct Subtract direct byte from A with borrow 2 2 95
SUBB A,@Ri Subtract indirect RAM from A with borrow 1 1 96, 97
SUBB A,#data Subtract immediate data from A with borrow 2 2 94
INC A Increment A 1 1 04
INC Rr Increment register 1 1 0*
INC direct Increment direct byte 2 2 05
INC @Ri Increment indirect RAM 1 1 06, 07
DEC A Decrement A 1 1 14
DEC Rr Decrement register 1 1 1*
DEC direct Decrement direct byte 2 2 15
DEC @Ri Decrement indirect RAM 1 1 16, 17
INC DPTR Increment data pointer 1 3 A3
MUL AB Multiply A and B 1 5 A4
DIV AB Divide A by B 1 5 84
DA A Decimal adjust A 1 1 D4
OPCODE
MNEMONIC DESCRIPTION BYTES CYCLES
(HEX)
Logic operations
ANL A,Rr AND register to A 1 1 5*
ANL A,direct AND direct byte to A 2 2 55
ANL A,@Ri AND indirect RAM to A 1 1 56, 57
ANL A,#data AND immediate data to A 2 2 54
ANL direct,A AND A to direct byte 2 2 52
ANL direct,#data AND immediate data to direct byte 3 3 53
ORL A,Rr OR register to A 1 1 4*
ORL A,direct OR direct byte to A 2 2 45
ORL A,@Ri OR indirect RAM to A 1 1 46, 47
ORL A,#data OR immediate data to A 2 2 44
ORL direct,A OR A to direct byte 2 2 42
ORL direct,#data OR immediate data to direct byte 3 3 43
XRL A,Rr Exclusive-OR register to A 1 1 6*
XRL A,direct Exclusive-OR direct byte to A 2 2 65
XRL A,@Ri Exclusive-OR indirect RAM to A 1 1 66, 67
XRL A,#data Exclusive-OR immediate data to A 2 2 64
XRL direct,A Exclusive-OR A to direct byte 2 2 62
XRL direct,#data Exclusive-OR immediate data to direct byte 3 2 63
CLR A Clear A 1 1 E4
CPL A Complement A 1 1 F4
RL A Rotate A left 1 1 23
RLC A Rotate A left through the carry flag 1 1 33
RR A Rotate A right 1 1 03
RRC A Rotate A right through the carry flag 1 1 13
SWAP A Swap nibbles within A 1 1 C4
OPCODE
MNEMONIC DESCRIPTION BYTES CYCLES
(HEX)
Data transfer
MOV A,Rr Move register to A 1 1 E*
MOV A,direct (note 1) Move direct byte to A 2 2 E5
MOV A,@Ri Move indirect RAM to A 1 1 E6, E7
MOV A,#data Move immediate data to A 2 2 74
MOV Rr,A Move A to register 1 1 F*
MOV Rr,direct Move direct byte to register 2 2 A*
MOV Rr,#data Move immediate data to register 2 2 7*
MOV direct,A Move A to direct byte 2 2 F5
MOV direct,Rr Move register to direct byte 2 2 8*
MOV direct,direct Move direct byte to direct 3 2 85
MOV direct,@Ri Move indirect RAM to direct byte 2 2 86, 87
MOV direct,#data Move immediate data to direct byte 3 3 75
MOV @Ri,A Move A to indirect RAM 1 1 F6, F7
MOV @Ri,direct Move direct byte to indirect RAM 2 2 A6, A7
MOV @Ri,#data Move immediate data to indirect RAM 2 2 76, 77
MOV DPTR,#data 16 Load data pointer with a 16-bit constant 3 3 90
MOVC A,@A+DPTR Move code byte relative to DPTR to A 1 3 93
MOVC A,@A+PC Move code byte relative to PC to A 1 3 83
MOVX A,@Ri Move external RAM (8-bit address) to A 1 2~9 EB, E3
MOVX A,@DPTR Move external RAM (16-bit address) to A 1 2~9 E0
MOVX @Ri,A Move A to external RAM (8-bit address) 1 2~9 F2, F3
MOVX @DPTR,A Move A to external RAM (16-bit address) 1 2~9 F0
PUSH direct Push direct byte onto stack 2 2 C0
POP direct Pop direct byte from stack 2 2 D0
XCH A,Rr Exchange register with A 1 1 C*
XCH A,direct Exchange direct byte with A 2 2 C5
XCH A,@Ri Exchange indirect RAM with A 1 1 C6, C7
XCHD A,@Ri Exchange LOW-order digit indirect RAM with A 1 1 D6, D7
Note
1. MOV A,ACC is not permitted.
Table 57 Instruction set: Boolean variable manipulation, Program and machine control
OPCODE
MNEMONIC DESCRIPTION BYTES CYCLES
(HEX)
Boolean variable manipulation
CLR C Clear carry flag 1 1 C3
CLR bit Clear direct bit 2 2 C2
SETB C Set carry flag 1 1 D3
SETB bit Set direct bit 2 2 D2
CPL C Complement carry flag 1 1 B3
CPL bit Complement direct bit 2 2 B2
ANL C,bit AND direct bit to carry flag 2 2 82
ANL C,/bit AND complement of direct bit to carry flag 2 2 B0
ORL C,bit OR direct bit to carry flag 2 2 72
ORL C,/bit OR complement of direct bit to carry flag 2 2 A0
MOV C,bit Move direct bit to carry flag 2 2 A2
MOV bit,C Move carry flag to direct bit 2 2 92
Branching
ACALL addr11 Absolute subroutine call 2 3 •1
LCALL addr16 Long subroutine call 3 4 12
RET Return from subroutine 1 4 22
RETI Return from interrupt 1 4 32
AJMP addr11 Absolute jump 2 3 ♦1
LJMP addr16 Long jump 3 4 02
SJMP rel Short jump (relative address) 2 3 80
JMP @A+DPTR Jump indirect relative to the DPTR 1 3 73
JZ rel Jump if A is zero 2 3 60
JNZ rel Jump if A is not zero 2 3 70
JC rel Jump if carry flag is set 2 3 40
JNC rel Jump if carry flag is not set 2 3 50
JB bit,rel Jump if direct bit is set 3 4 20
JNB bit,rel Jump if direct bit is not set 3 4 30
JBC bit,rel Jump if direct bit is set and clear bit 3 4 10
CJNE A,direct,rel Compare direct to A and jump if not equal 3 4 B5
CJNE A,#data,rel Compare immediate to A and jump if not equal 3 4 B4
CJNE Rr,#data,rel Compare immediate to register and jump if not equal 3 4 B*
CJNE @Ri,#data,rel Compare immediate to indirect and jump if not equal 3 4 B6, B7
DJNZ Rr,rel Decrement register and jump if not zero 2 3 D*
DJNZ direct,rel Decrement direct and jump if not zero 3 4 D5
NOP No operation 1 1 00
All mnemonics are copyright © Intel Corporation 1980.
MNEMONIC DESCRIPTION
Data addressing modes
Rr Working register R0-R7.
direct 128 internal RAM locations and any special function register (SFR).
@Ri Indirect internal RAM location addressed by register R0 or R1 of the actual register bank.
#data 8-bit constant included in instruction.
#data 16 16-bit constant included as bytes 2 and 3 of instruction.
bit Direct addressed bit in internal RAM or SFR.
addr16 16-bit destination address. Used by LCALL and LJMP.
The branch will be anywhere within the 64 kbytes Program Memory address space.
addr11 11-bit destination address. Used by ACALL and AJMP. The branch will be within the same 2 kbytes
page of Program Memory as the first byte of the following instruction.
rel Signed (two's complement) 8-bit offset byte. Used by SJMP and all conditional jumps.
Range is −128 to +127 bytes relative to first byte of the following instruction.
Hexadecimal opcode cross-reference
* 8, 9, A, B, C, D, E, F.
• 1, 3, 5, 7, 9, B, D, F.
♦ 0, 2, 4, 6, 8, A, C, E.
Syntek Semiconductors
8-bit microcontroller
First hexadecimal character of opcode ← Second hexadecimal character of opcode →
↓ 0 1 2 3 4 5 6 7 8 9 A B C D E F
AJMP LJMP RR INC INC INC @Ri INC Rr
0 NOP
addr11 addr16 A A direct 0 1 0 1 2 3 4 5 6 7
JBC ACALL LCALL RRC DEC DEC DEC @Ri DEC Rr
1
bit,rel addr11 addr16 A A direct 0 1 0 1 2 3 4 5 6 7
JB AJMP RL ADD ADD ADD A,@Ri ADD A,Rr
2 RET
bit,rel addr11 A A,#data A,direct 0 1 0 1 2 3 4 5 6 7
JNB ACALL RLC ADDC ADDC ADDC A,@Ri ADDC A,Rr
3 RETI
bit,rel addr11 A A,#data A,direct 0 1 0 1 2 3 4 5 6 7
JC AJMP ORL ORL ORL ORL ORL A,@Ri ORL A,Rr
4
rel addr11 direct,A direct,#data A,#data A,direct 0 1 0 1 2 3 4 5 6 7
JNC ACALL ANL ANL ANL ANL ANL A,@Ri ANL A,Rr
5
rel addr11 direct,A direct,#data A,#data A,direct 0 1 0 1 2 3 4 5 6 7
JZ AJMP XRL XRL XRL XRL XRL A,@Ri XRL A,Rr
6
rel addr11 direct,A direct,#data A,#data A,direct 0 1 0 1 2 3 4 5 6 7
101
JNZ ACALL ORL JMP MOV MOV MOV @Ri,#data MOV Rr,#data
7
rel addr11 C,bit @A+DPTR A,#data direct,#data 0 1 0 1 2 3 4 5 6 7
SJMP AJMP ANL MOVC DIV MOV MOV direct,@Ri MOV direct,Rr
8
rel addr11 C,bit A,@A+PC AB direct,direct 0 1 0 1 2 3 4 5 6 7
MOV ACALL MOV MOVC SUBB SUBB SUBB A,@Ri SUB A,Rr
9
DTPR,#data16 addr11 bit,C A,@A+DPTR A,#data A,direct 0 1 0 1 2 3 4 5 6 7
ORL AJMP MOV INC MUL MOV @Ri,direct MOV Rr,direct
A
C,/bit addr11 bit,C DPTR AB 0 1 0 1 2 3 4 5 6 7
ANL ACALL CPL CPL CJNE CJNE CJNE @Ri,#data,rel CJNE Rr,#data,rel
B
C,/bit addr11 bit C A,#data,rel A,direct,rel 0 1 0 1 2 3 4 5 6 7
PUSH AJMP CLR CLR SWAP XCH XCH A,@Ri XCH A,Rr
C
Product specification
direct addr11 bit C A A,direct 0 1 0 1 2 3 4 5 6 7
STK6032
POP ACALL SETB SETB DA DJNZ XCHD A,@Ri DJNZ Rr,rel
D
direct addr11 bit C A direct,rel 0 1 0 1 2 3 4 5 6 7
Draft 2008 Jul 09
Syntek Semiconductors
First hexadecimal character of opcode ← Second hexadecimal character of opcode →
8-bit microcontroller
↓ 0 1 2 3 4 5 6 7 8 9 A B C D E F
MOVX AJMP MOVX A,@Ri CLR MOV MOV A,@Ri MOV A,Rr
E
A,@DTPR addr11 0 1 A A,direct (1) 0 1 0 1 2 3 4 5 6 7
MOVX ACALL MOVX @Ri,A CPL MOV MOV @Ri,A MOV Rr,A
F
@DTPR,A addr11 0 1 A direct,A 0 1 0 1 2 3 4 5 6 7
Note
1. MOV A, ACC is not a valid instruction.
Product specification
STK6032
Draft 2008 Jul 09 27 PLCC44 PACKAGE OUTLINE DWRAWING
Syntek Semiconductors
103
STK6032
Fig.51 STK6032 PLCC44 Package Outline Drawing
Draft 2008 Jul 09 28 QFP44 PACKAGE OUTLINE DRAWING
Syntek Semiconductors
104
STK6032
Fig.52 STK6032 QFP44 Package Outline Drawing
Draft 2008 Jul 09 29 LQFP48 PACKAGE OUTLINE DRAWING
Syntek Semiconductors
105
STK6032
Fig.53 STK6032 LQFP48 Package Outline Drawing