The Ultra-High-Speed Flash Microcontroller User’s Guide should be used in conjunction with the data sheet(s) for all ultra-high-speed flash microcontrollers.
Rev: 11; 11/11
Ultra-High-Speed Flash
REVI S ION
NUMBER
REVI S ION
DATE
SECTION
NUMBER
DESCRIPTION
PAGES
CHANGED
01/01—Init i a l relea se.—
110/02—Corrected some t ypo s.
212/02—Changed title to refle ct “ f las h ” and removed “DS89C 42 0 ” referenc e.Al l
38/03—Made documen t un iver s a l to a l l Dal l a s u ltr a-h igh-speed mi cro co ntro l lers.Al l
4Clarif i ed t hat t h e C T M bit is c leared in stop mode.14
5Corrected cycle time s for ADDC A, R n instr uc t io n .50
42/04
15In the C o m ma nd Summar ies secti o n , c larifi ed t ha t PMR SFR i s not disp la yed i n ROM loader.133
58/044Added FCNTL and FDATA to the Specia l-Fu n ct i o n Regis t er Lo ca t io n s tabl e.14, 15
612/0415Changed the ACK /N A K re sp on ses in th e Co mmand Summar ie s sec t io n .136
15
In the Com ma nd Summ ar ie s se c t i o n , c l ar ified tha t th e boot loader K co m ma nd does not erase t h e opt ion
control regi ster, whic h co ntr o l s the defaul t state o f t h e en ab le watchdog tim er bit.
136
15
Remo ved infor mat ion pertain ing to the paral lel programming m ode and inst e ad referred interest ed partie s to
contact microcon tro l ler t ec h n i c a l sup port directl y for more informa t io n .
138
710/05
4Added Rev i sio n ID SFR.14, 15, 26
12Cl ari f i ed t he sele c t i o n of the sh ift c lo ck frequenc y for Mode 0 (fir st paragraph, last sent en c e).116
83/07
14
In Instr uct ion Set Deta i l s for the D at a Tr an sf er tab le secti o n , changed "=" to " " for XCH A, Rn ; XCH a, direct;
XCH A, @R i ; and XCHD A, @R i; and changed ORLC, bit (72h) D7 from 1 to 0 in the Bo o lea n Variab le
Manipu l a t ion tab le sect i o n ; ch a nged the i n structi o n code for JZ rel (60h) D7 from 1 to 0 and D6 and D5 from
0 to 1 and for JNZ rel (70h) D7 from 1 to 0 and D6, D5, and D4 from 0 to 1; ch anged the JNB bi t, re l (30h) D5
from 0 to 1 and CJ NE A, d irect, r e l (B5 h) D6 from 0 to 1.
128, 12 9,
130
96/074Corrected bi t na m e headings f or the R MS[2:0] tab le .32
103/084Corrected formatting errors.23, 24
1111/114Corrected the T i m er 1 a nd 0 bit d e scr iptions for the CKMOD regist er ( swapped 1 and 0 for respecti ve t im er s)4–21
Microcontroller User’s Guide
REVISION HISTORY
Maxim cannot assume responsibility for use of any circuitry other than circuitry entirely embodied in a Maxim product. No circuit patent licenses are implied. Maxim reserves the right to change the
circuitry and specifications without notice at any time.
Maxim Integrated Products, 120 San Gabriel Drive, Sunnyvale, CA 94086 408-737-7600 _______________________________________________________ 1
Maxim’s ultra-high-speed flash microcontroller is an 8051-compatible microcontroller that provides improved performance and power
consumption when compared to the original 8051 version. It retains instruction set and object code compatibility with the 8051, yet performs the same operations in fewer clock cycles. Consequently, greater throughput is possible for the same crystal speed. As an alternative, the device can be run at a reduced frequency to save power. The more efficient design allows a much slower crystal speed to
get the same results as an original 8051, using much less power.
The fundamental innovation of the ultra-high-speed flash microcontroller is the use of only one clock per instruction cycle compared
with 12 for the original 8051. This results in up to 12 times improvement in performance over the original 8051 architecture and up to
four times improvement over other Maxim high-speed microcontrollers. The device provides several peripherals and features in addition to all of the standard features of an 80C32. These include 16kB/32kB/64kB of on-chip flash memory, 1kB of on-chip RAM, four 8-bit
I/O ports, three 16-bit timer/counters, two on-chip UARTs, dual data pointers, an on-chip watchdog timer, five levels of interrupt priority,
and a crystal multiplier. The device provides 256 bytes of RAM for variables and stack; 128 bytes can be reached using direct or indirect
addressing, or using indirect addressing only.
In addition to improved efficiency, it can operate at a maximum clock rate of 33MHz. Combined with the 12 times performance, this
allows for a maximum performance of 33 million instructions per second (MIPS). This level of computing power is comparable to many
16-bit processors, but without the added expense and complexity if implementing a 16-bit interface.
The device incorporates a power-management mode that allows the device to dynamically vary the internal clock speed from 1 clock
per cycle (default) to 1024 clocks per cycle. Because power consumption is directly proportional to clock speed, the device can reduce
its operating frequency during periods of little switchback. This greatly reduces power consumption. The switchback feature allows the
device to quickly return to highest speed operation upon receipt of an interrupt or serial port activity, allowing the device to respond to
external events while in power-management mode.
Maxim Integrated
1-1
Ultra-High-Speed Flash
Microcontroller User’s Guide
SECTION 2: ORDERING INFORMATION
The ultra-high-speed flash microcontroller family follows the part numbering convention shown below. Note that not all combinations of
devices may be currently available. Contact a Maxim sales office for up-to-date details.
The architecture is based on the industry-standard 87C52 and executes the standard 8051 instruction set. The core is an accumulator-based architecture using internal registers for data storage and peripheral control. This section provides a brief description of each
architecture feature. Details concerning the programming model, instruction set, and register description are provided in Section 4.
ALU
The ALU is responsible for math functions, comparisons, and general decision making. The ALU is not used explicitly by software.
Instruction decoding prepares the ALU automatically and passes it the appropriate data. The ALU primarily uses two special-function
registers (SFRs) as the source and destination for all operations. These are the accumulator and B register. The ALU also provides status information in the program status register. The SFRs are described in the following pages.
Special-Function Registers
All peripherals and operations that are not explicitly controlled by instructions are controlled through SFRs. All SFRs are described in
Section 4. The most commonly used registers that are basic to the architecture are also described in the following pages.
Accumulator
The accumulator is a source and destination for many operations involving math, data movement, and decisions. Although it can be
bypassed, most high-speed instructions require the use of the accumulator (A or ACC) as one argument.
B Register
The B register is used as the second 8-bit argument in multiply and divide operations. When not used for these purposes, the B register can be used as a general-purpose register.
Program Status Word
The program status word holds a selection of bit flags that include the carry flag, auxiliary carry flag, general-purpose flag, register
bank select, overflow flag, and parity flag.
Data Pointer(s)
The data pointers (DPTR and DPTR1) are used to assign a memory address for the MOVX instructions. This address can point to a
data memory location, either on- or off-chip, or a memory-mapped peripheral. When moving data from one memory area to another or
from memory to a memory-mapped peripheral, a pointer is needed for both the source and destination. The user can select the active
pointer through a dedicated SFR bit (Sel = DPS.0), or can activate an automatic toggling feature for altering the pointer selection (TSL
= DPS.5). An additional feature, if selected, provides automatic incrementing or decrementing of the current DPTR.
Stack Pointer
The stack pointer denotes the register location at the top of the stack, which is the last used value. The user can place the stack anywhere in the scratchpad RAM by setting the stack pointer to the desired location, although the lower bytes are normally used for working registers.
I/O Ports
Four 8-bit I/O ports are available. Each I/O port is represented by an SFR location, and can be written or read. The I/O port has a latch
that contains the value written by software. In general, software reads the state of external pins during a read operation.
Timer/Counters
Three 16-bit timer/counters are available. Each timer is contained in two SFR locations that can be written or read by software. The
timers are controlled by other SFRs described in Section 4.
UARTs
The two UARTs are controlled and accessed by SFRs. Each UART has an address that is used to read and write the UART. The same
address is used for both read and write operations, which are distinguished by the instruction. Each UART is controlled by its own SFR
control register.
The high-speed core provides 256 bytes of scratchpad RAM for general-purpose data and variable storage. The first 128 bytes are
directly available to software. The second 128 are available through indirect addressing. Selected portions of this RAM have other
optional functions.
Stack
The stack is a RAM area that stores return address information during calls and interrupts. The user can also place variables on the
stack when necessary. The stack pointer designates the RAM location that is the top of the stack. Thus, depending on the value of the
stack pointer, the stack can be located anywhere in the 256 bytes of RAM. A common location would be in the upper 128 bytes of
RAM, as these locations are accessible through indirect addressing only.
Working Registers
The first 32 bytes of the scratchpad RAM can be used as four banks of eight working registers for high-speed data movement. Using
four banks, software can quickly change context by changing to a different bank. In addition to the accumulator, the working registers
are commonly used as data source or destination. Some of the working registers can also be used as pointers to other RAM locations
(indirect addressing).
Program Counter
The program counter (PC) is a 16-bit value that designates the next program address to be fetched. On-chip hardware automatically
increments the PC value to move to the next program memory location.
Address/Data Bus
The device addresses a 64kB program and 64kB data memory area that resides in a combination of internal and external memory. When
external memory is accessed, ports 0 and 2 are used as a multiplexed address and data bus. Three external memory bus structures
are supported. The nonpage mode (traditional 8051) bus structure provides the address MSB on port 2 and multiplexes port 0 between
address LSB and data. The page mode 1 bus structure uses port 0 exclusively for data and multiplexes port 2 between address MSB
and address LSB. The page mode 2 bus structure uses port 0 exclusively for address LSB and multiplexes port 2 between address MSB
and data. These addressing modes are detailed later.
Watchdog Timer
The watchdog timer provides a supervisory function for applications that cannot afford to run out of control. The watchdog timer is a
programmable, free-running timer. If allowed to reach the termination of its count, if enabled, the watchdog resets the CPU software
must prevent this by clearing or resetting the watchdog prior to its timeout.
Power Monitor
A bandgap reference and analog circuitry are incorporated to monitor the power-supply conditions. When VCCbegins to drop out of
tolerance, the power monitor issues an optional early warning power-fail interrupt. If power continues to fall, the power monitor invokes
a reset condition. This remains until power returns to normal operating voltage. The power monitor also functions on power-up, holding the microcontroller in a reset state until power is stable.
Interrupts
The device is capable of evaluating 13 interrupt sources simultaneously. Each interrupt has an associated interrupt vector, flag, priority, and enable. These interrupts can be globally enabled or disabled.
Timing Control
The microcontroller provides an on-chip oscillator for use with an external crystal. This can be bypassed by injecting a clock source
into the XTAL1 pin. The clock source is used to create machine cycle timing (four clocks), ALE, PSEN, watchdog, timer, and serial baudrate timing. In addition, an on-chip ring oscillator can be used to provide an approximately 10MHz clock source. A frequency multiplier feature is included, which can be selected by SFR control to multiply the input clock source by either two or four. This allows lower
frequency (and cost) crystals to be used while still allowing internal operation up to the full 33MHz limit.
3-3
Maxim Integrated
Ultra-High-Speed Flash
Microcontroller User’s Guide
Flash Memory
On-chip program memory is implemented in flash memory. This can be programmed in-system with the standard 5V VCCsupply
through a serial port (in-system) using a built-in program memory loader, or by a standard flash or EPROM programmer. Full programming details are given in Section 15.
A memory management unit (MMU) and other hardware supports any of the three programming methods. The MMU controls program
and data memory access, and provides sequencing and timing controls for programming of the on-chip program memory
also a separate security flash block that is used to support a standard three-level lock, a 64-byte encryption array, and other flash
options.
The full on-chip program memory range can be fetched by the processor automatically. Reset routines and all interrupt vectors are
located in the lower 128 bytes of the on-chip program memory area.
This section provides a programmer’s overview of the ultra-high-speed microcontroller core. It includes information on the memory
map, on-chip RAM, SFRs, and instruction set. The programming model of the ultra-high-speed microcontroller is very similar to that of
the industry-standard 80C52. The memory map is identical. It uses the same instruction set, with improved instruction timing. Several
new SFRs have been added.
Memory Organization
The ultra-high-speed flash microcontroller, like the 8052, uses several distinct memory areas. These areas include registers, program
memory, and data memory. Registers serve to control on-chip peripherals and as RAM. Note that registers (on-chip RAM) are separate from data memory. Registers are divided into three categories including directly addressed on-chip RAM, indirectly addressed onchip RAM, and SFRs. The program and data memory areas are discussed in the Memory Map section. The registers are discussed in
the Register Map section.
Memory Map
The ultra-high-speed microcontroller uses a memory-addressing scheme that separates program memory from data memory. Each
area is 64kB beginning at address 0000h and ending at FFFFh, as shown in Figure 4-1. The program and data segments can overlap
since they are accessed in different ways. Program memory is fetched by the microcontroller automatically. These addresses are never
written by software. In fact, there are no instructions that allow the program area to be written. There is one instruction (MOVC) that is
used to explicitly read the program area. This is commonly used to read lookup tables. The data memory area is accessed explicitly
using the MOVX instruction. This instruction provides multiple ways of specifying the target address. It is used to access the 64kB of
data memory.
The address and data range of devices with on-chip program and data memory overlap the 64k memory space. When on-chip memory is enabled, accessing memory in the on-chip range causes the device to access internal memory. Memory accesses beyond the
internal range are addressed externally through ports 0 and 2.
The ROMSIZE feature allows software to dynamically configure the maximum address of on-chip program memory. This allows the
device to act as a bootstrap loader for an external flash or nonvolatile SRAM. Secondly, this method can also be used to increase the
amount of available program memory from 64kB to 80kB without bank switching. For more information on this feature, see Section 6.
Pr
ogram and data memory can also be increased beyond the 64kB limit using bank-switching techniques. This is described in
Application Note 81: Memory Expansion with the High-Speed Microcontroller Family.
Register Map
The register map is illustrated in Figure 4-2. It is entirely separate from the program and data memory areas mentioned above. A separate class of instructions is used to access the registers. There are 256 potential register location values. In practice, the ultra-highspeed microcontroller has 256 bytes of scratchpad RAM and up to 128 SFRs. This is possible since the upper 128 scratchpad RAM
locations can only be accessed indirectly. That is, the contents of a working register (R0 or R1) or the stack pointer designates the RAM
location. A direct reference to one of the lower 128 addresses (0h-7Fh) accesses the scratchpad RAM. A direct reference to one of the upper
128 addresses (80h-FFh) must be an SFR access. In contrast, indirect references can access the entire scratchpad RAM range (0h-FFh).
Scratchpad RAM is available for general-purpose data storage. It is commonly used in place of off-chip RAM when the total data contents are small. When off-chip RAM is needed, the scratchpad area still provides the fastest general-purpose access. Within the 256
bytes of RAM, there are several special purpose areas. These are described as follows:
In addition to direct register access, some individual bits are also accessible. These are individually addressable bits in both the RAM
and SFR area. In the scratchpad RAM area, registers 20h to 2Fh are bit addressable. This provides 128 (16 x 8) individual bits available to software. A bit access is distinguished from a full register access by the type of instruction. Addressing modes are discussed
later in this section. In the SFR area, any register location ending in a 0 or 8 is bit addressable. Figure 4-3 shows details of the on-chip
RAM addressing, including the locations of individual RAM bits.
Working Registers
As part of the lower 128 bytes of RAM, there are four banks of working registers (8 bytes each). The working registers are general-purpose
RAM locations that can be addressed in a special way. They are designated R0 through R7. Since there are four banks, the currently
selected bank is used by any instruction using R0–R7. This allows software to change context by simply switching banks. This is controlled through the program status word register in the next SFR area. The working registers also allow their contents to be used for
indirect addressing of the upper 128 bytes of RAM. Thus, an instruction can designate the value stored in R0 (for example) to address
the upper RAM. This value might be the result of another calculation.
Stack
Another use of the scratchpad area is for the programmer’s stack. This area is selected using the stack pointer (SP;81h) SFR. Whenever
a call or interrupt is invoked, the return address is placed on the stack. It also is available to the programmer for variables, etc. Since
the stack can be moved, there is no fixed location within the RAM designated as stack. The stack pointer defaults to 07h upon reset.
The user can then move it as needed. A convenient location would be the upper RAM area (>7Fh), since this is only available indirectly. The SP points to the last used value. Therefore, the next value placed on the stack is put at SP + 1. Each PUSH or CALL increments the SP by the appropriate value. Each POP or RET decrements as well.
Addressing Modes
The DS89C420 uses the standard 8051 instruction set that is supported by a wide range of third-party assemblers and compilers. Like
the 8051, the DS89C420 uses three memory areas. These are program memory, data memory, and registers. The program and data
areas are 64kB each. They extend from 0000h to FFFFh. The register areas are located between 00h and FFh, but do not overlap with
the program and data segments. This is because the ultra-high-speed flash microcontroller uses different modes of addressing to
reach each memory segment. These modes are described below.
Program memory is the area from which all instructions are fetched. It is inherently read only. This is because the 8051 instruction set
provides no instructions that write to this area. Read/write access is for data memory and registers only. No special action is required
to fetch from program memory. Each instruction fetch is performed automatically by the on-chip CPU. In versions that contain on-chip
memory, the hardware decides whether the fetch is on-chip or off-chip based on the address. Explicit addressing modes are needed
for the data memory and register areas. These modes determine which register area is accessed or if off-chip data memory is used.
The ultra-high-speed microcontroller supports eight addressing modes:
• Register addressing
• Direct addressing
• Register indirect addressing
• Immediate addressing
• Register indirect addressing with displacement
• Relative addressing
• Page addressing
• Extended addressing
Five of the eight addressing modes are used to address operands. The remainder are used for program control and branching. When
writing assembly language instructions that use arguments, the convention is “destination, source.” Each mode of addressing is summarized on the following pages. Note that many instructions (such as ADD) have multiple-addressing modes available.
4-7
Maxim Integrated
Ultra-High-Speed Flash
Microcontroller User’s Guide
Register Addressing
Register addressing is used for operands that are located in one of the eight working registers (R7–R0). The eight working registers
can be located in one of four working register banks found in the lower 32 bytes of scratchpad RAM, as determined by the current register bank-select bits. A register bank is selected using two bits in the program status word (PSW;D0h). This addressing mode is powerful, since it uses the active bank without knowing which bank is selected. Thus, one instruction can have multiple uses by simply
switching banks. Register addressing is also a high-speed instruction, requiring only one machine cycle. Two examples of register
addressing are provided below:
ADDA, R4;Add register R4 to Accumulator
INC R2;Increment the value in register R2
In the first case, the value in R4 is the source of the operation. In the latter, R2 is the destination. These instructions do not consider
the absolute address of the register. They act on whichever bank has been selected.
Any working register can also be accessed by direct addressing. In order to do this, the absolute address must be specified.
Direct Addressing
Direct addressing is the mode used to access the entire lower 128 bytes of scratchpad RAM and the SFR area. It is commonly used
to move the value in one register to another. Two examples are shown below:
MOV 72h, 74h;Move the value in register 74 to
;register 72.
MOV 90h, 20h;Move the value in register 20 to
;the SFR at 90h (Port 1)
Note that there is no instruction difference between a RAM access and an SFR access. The SFRs are register locations above 7Fh.
Direct addressing also extends to bit addressing. There is a group of instructions that explicitly use bits. The addr
vided to such an instruction is the bit location, rather than the register address. Registers between 20h and 2Fh contain bits that are
individually addr
SETB 00h;Set bit 00 in the RAM. This is the
MOV C, 0B7h;Move the contents of bit B7 to the
essable. SFRs that end in 0 or 8 are bit addressable. An example of direct bit addressing is as follows:
;LSb of the register at address 20h
;as shown earlier in this section.
;Carry flag. Bit B7 is the MSb of
;register B0 (Port 3).
ess information pro-
Register Indirect Addressing
This mode is used to access the scratchpad RAM locations above 7Fh. It can also be used to reach the lower RAM (0h–7Fh), if needed. The address is supplied by the contents of the working register specified in the instruction. Thus, one instruction can be used to
reach many values by altering the contents of the designated working register. Note that, in general, only R0 and R1 can be used as
pointers. An example of register indirect addressing follows:
ANL A, @R0;Logical AND the Accumulator
;with the contents of the register
;pointed to by the value stored in R0.
This mode is also used for stack manipulation. This is because all stack references are directed by the value in the stack pointer register. The push and pop instructions use this method of addressing. An example is as follows:
PUSH A;Saves the contents of the
;accumulator on the stack.
Register indirect addressing is used for all off-chip data memory accesses. These involve the MOVX instruction. The pointer registers
can be R0, R1, DPTR0 and DPTR1. Both R0 and R1 reside in the working register ar
reference a 256-byte area of off-chip data memory. When using this type of addressing, the upper addr
value in the port 2 latch. This value must be selected by software prior to the MOVX instruction. An example is as follows:
MOVX @R0, A;Write the value in the accumulator
;to the address pointed to by R0 in
;the page pointed to by P2.
The 16-bit data pointers (DPTRs) can be used as an absolute off-chip reference. This gives access to the entire 64kB data memory
map. An example is as follows:
MOVX @DPTR, A;Write the value in the accumulator
;to the address referenced by the
;selected data pointer.
Immediate Addressing
Immediate addressing is used when one of the operands is predetermined and coded into the software. This mode is commonly used
to initialize SFRs and to mask particular bits without affecting others. An example is as follows:
ORL A, #40h;Logical OR the Accumulator with 40h.
Register Indirect with Displacement
Register indirect addressing with displacement is used to access data in lookup tables in program memory space. The location is created using a base address with an index. The base address can be either the PC or the DPTR. The index is the accumulator. The result
is stored in the accumulator. An example is as follows:
MOVC A, @A +DPTR;Load the accumulator with the contents
of program memory
;pointed to by the contents of the DPTR
plus the value in
;the accumulator.
Relative Addressing
Relative addressing is used to determine a destination address for the conditional branch. Each of these instructions includes an 8-bit
value that contains a two’s complement address offset (-127 to +128), which is added to the PC to determine the destination address.
This destination is branched to when the tested condition is true. The PC points to the program memory location immediately following the branch instruction when the offset is added. If the tested condition is not true, the next instruction is performed. An example is
as follows:
JZ $–20;Branch to the location (PC+2)–20
;if the contents of the accumulator = 0.
Page Addressing
Page addressing is used by the branching instructions to specify a destination address within the same 2kB block as the next contiguous instruction. The full 16-bit address is calculated by taking the five highest-order bits for the next instruction (PC + 2) and
concatenating them with the lowest order 11-bit field contained in the current instruction. An example is as follows:
0870h ACALL 100h;Call to the subroutine at address 100h
plus the
;current page address.
In this example, the current page address is 800h, so the destination address is 900h.
Extended Addressing
Extended addressing is used by the branching instructions to specify a 16-bit destination address within the 64kB address space. The
destination address is fixed in the software as an absolute value. An example is as follows:
LJMP 0F732h;Jump to address 0F732h.
4-9
Maxim Integrated
Ultra-High-Speed Flash
INSTRUC TIONFLAGSINSTRUCTIONFLAGS
COVACCOVAC
ADDXXXCLR C0
ADDCXXXC PL CX
SUBBXXXANL C , bitX
MUL0XANL C, bitX
DIV0XORL C, bitX
DAXORL C, bitX
RRCXMOV C, bitX
RLCXCJNEX
SETB C1——
Microcontroller User’s Guide
Program Status Flags
All program status flags are contained in the program status word at SFR location D0h. It contains flags that reflect the status of the CPU
and the result of selected operations. The flags are summarized below. The following table shows the instructions that affect each flag.
Bit Description*:
PSW.7C
CarrySet when the previous operation resulted in a carry (during addition) or a borrow (during subtraction). Otherwise
cleared.
PSW.6AC
Auxiliary CarrySet when the previous operation resulted in a carry (during addition) or a borrow (during subtraction) from the
high-order nibble. Otherwise cleared.
PSW.2 OV
OverflowFor addition, OV is set when a carry is generated into a high order bit (bit 6 or bit 7), but not a carry out of the
same high-order bit. For subtraction, OV is set if a borrow is needed into a high order bit (bit 6 or bit 7), but not
into the other high-order bit. For multiplication, OV is set when the product exceeds FFh. For division, OV is
always cleared.
PSW.0P
ParitySet to logic 1 to indicate an odd number of ones in the accumulator (odd parity). Cleared for an even number of
ones. This produces even parity.
*All of these bits are cleared to a logic 0 for all resets.
Table 4-1. Instructions that Affect Flag Settings
Note: X indicates the modification is according to the result of the instruction.
Special-Function Register Locations
The ultra-high-speed flash microcontroller, like the 8051, uses SFRs to control peripherals and modes. In many cases, an SFR controls
individual functions or report status on individual functions. The SFRs reside in register locations 80h–FFh and are reached using direct
addressing. SFRs that end in 0 or 8 are bit addressable.
All standard SFR locations from the original 8051 are duplicated, with several additions. Tables are provided to illustrate the locations
of the SFRs and the default reset conditions of all SFR bits. Detailed descriptions of each SFR follow.
Most of the unique features of the ultra-high-speed microcontroller family are controlled by bits in SFRs located in unused locations in the 8051 SFR map. This allows for increased functionality while maintaining complete instruction set compatibility.
The description for each bit indicates its read and write access, as well as its state after a power-on reset.
Port 0 (P0)
R = Unrestricted read, W = Unrestricted write, -n = Value after reset
P0.7–0
Bits 7–0
Port 0. This port functions according to the table below where PAGEE = ACON.7 and PAGES =
ACON.6-5.
Table 4-4. Port 0 Function
When serving as general-purpose I/O (GPIO), the por
a 1 to one of the bits of this register configures the associated port 0 pin as an input. All read operations, with the exception of read-modify-write instructions, leave the port latch unchanged. During
external memory addressing and data memory write cycles, the port has high-and-low drive capability. During external memory data read cycles, the port is held in a high-impedance state.
Stack Pointer (SP)
R = Unrestricted read, W = Unrestricted write, -n = Value after reset
SP.7–0
Bits 7–0
Stack Pointer. This stack pointer is written by software to identify the location where the stack
begins. The stack pointer is incremented before every PUSH operation and is decremented following every POP operation. This register defaults to 07h after reset.
t is open-drain and requires pullups. Writing
Data Pointer Low 0 (DPL)
R = Unrestricted read, W = Unrestricted write, -n = Value after reset
DPL.7–0
Bits 7–0
4-13
Data Pointer LOW 0. This register is the low byte of the standard 80C32 16-bit data pointer. DPL
and DPH are used to point to nonscratchpad data RAM.
R = Unrestricted read, W = Unrestricted write, -n = Value after reset
Ultra-High-Speed Flash
Microcontroller User’s Guide
DPH.7–0
Bits 7–0
Data Pointer High 0. This register is the high byte of the standard 80C32 16-bit data pointer. DPL
and DPH are used to point to nonscratchpad data RAM.
Data Pointer Low 1 (DPL1)
R = Unrestricted read, W = Unrestricted write, -n = Value after reset
DPL1.7–0
Bits 7–0
Data Pointer Low 1. This register is the low byte of the auxiliary 16-bit data pointer. When the SEL
bit (DPS.0) is set, DPL1 and DPH1 are used in place of DPL and DPH during DPTR operations.
Data Pointer High 1 (DPH1)
R = Unrestricted read, W = Unrestricted write, -n = Value after reset
DPH1.7–0
Bits 7–0
Data Pointer Low 1. This register is the high byte of the auxiliary 16-bit data pointer. When the SEL
bit (DPS.0) is set, DPL1 and DPH1 are used in place of DPL and DPH during DPTR operations.
Data Pointer Select (DPS)
R = Unrestricted read, W = Unrestricted write, -n = Value after reset
ID1
Bit 7
ID0
Bit 6
Maxim Integrated
Increment/Decrement Select for DPTR1. This bit determines the effect of the INC DPTR instruction on DPTR1 when selected (SEL = 1) as the active data pointer.
0 = INC DPTR increments DPTR1 (default)
1 = INC DPTR decrements DPTR1
Increment/Decrement Select for DPTR. This bit determines the effect of the INC DPTR instruction on DPTR when selected (SEL = 0) as the active data pointer
Toggle Select. When clear (= 0), DPTR-related instructions do not affect the SEL bit. When set
(= 1), the SEL bit is toggled following execution of any of the below DPTR-related instructions:
INC DPTR
MOV DPTR, #data16
MOVC A, @A+DPTR
MOVX A, @DPTR
MOVX @DPTR, A
Autoincrement/Decrement Enable. When set, the active data pointer is automatically incremented or decr
DPTR-related instructions:
MOVC A, @A+DPTR
MOVX A, @DPTR
MOVX @DPTR, A
Reserved. These bits read 010b.
Data Pointer Select. This bit selects the active data pointer.
0 = Instructions that use the DPTR use DPL and DPH.
1 = Instructions that use the DPTR use DPL1 and DPH1.
emented (as determined by ID1, ID0 bit settings) following execution of any of the below
R = Unrestricted read, W = Unrestricted write, -n = Value after reset, * = See description
SMOD_0
Bit 7
SMOD0
Bit 6
OFDF
Bit 5
OFDE
Bit 4
GF1
Bit 3
GF0
Bit 2
Serial Port 0 Baud Rate Doubler Enable. This bit enables/disables the serial baud rate doubling
function for Serial Port 0.
0 = Serial Port 0 baud rate is that defined by baud rate generation equation.
1 = Serial Port 0 baud rate is double that defined by baud rate generation equation.
Framing Error Detection Enable. When clear (= 0), SCON1.7 and SCON0.7 serve as mode select
bit SM0 for the r
Framing Error has been detected.
Oscillator Fail Detect Flag. When OFDE = 1, this flag will be set if a reset condition is generated
due to oscillator failure. This bit is cleared on a power-on reset and is unchanged by other reset
sources. This bit must be clear
Oscillator Fail Detect Enable. When set (= 1), the oscillator fail detect circuitry and flag generation are enabled. An oscillator fail detection occurs if the crystal oscillator falls below ~20kHz. An
oscillator fail detection does not occur if the oscillator is halted through softwar
bit (PCON.1) or when running from the internal ring oscillator source. When clear (= 0), the oscillator fail detect circuitry is disabled.
General-Purpose User Flag 1. This is a general-purpose flag for software control.
General-Purpose User Flag 0. This is a general-purpose flag for software contr
espective serial ports. When set (= 1), SCON1.7 and SCON0.7 report whether a
ed by software.
e setting of the STOP
ol.
4-15
Maxim Integrated
Ultra-High-Speed Flash
76543210
SFR 88hTF1TR1TF0TR0IE1IT1IE0IT0
RW-0RW-0RW-0RW-0RW-0RW-0RW-0RW-0
Microcontroller User’s Guide
STOP
Bit 1
IDLE
Bit 0
Stop Mode Select. Setting this bit stops program execution, halts the CPU oscillator and internal
timers, and places the CPU in a low-power mode. This bit always be reads as a 0. Setting this bit
causes the CTM bit (PMR.4) to be cleared. Setting both the STOP bit and the IDLE bit causes the
device to enter stop mode; however, doing this is not advised.
Idle Mode Select. Setting this bit stops program execution but leaves the CPU oscillator, timers,
serial ports, and interrupts active. This bit is always read as a 0. Setting both the STOP bit and the
IDLE bit causes the device to enter stop mode; however, doing this is not advised.
Timer/Counter Control (TCON)
R = Unrestricted read, W = Unrestricted write, -n = Value after reset
TF1
Bit 7
TR1
Bit 6
TF0
Bit 5
TR0
Bit 4
IE1
Bit 3
IT1
Bit 2
IE0
Bit 1
IT0
Bit 0
Timer 1 Overflow Flag. This bit indicates when Timer 1 overflows its maximum count as defined
by the current mode. This bit can be cleared by software and is automatically cleared when the
CPU vectors to the Timer 1 interrupt service routine.
0 = No Timer 1 overflow has been detected.
1 = Timer 1 has overflowed its maximum count.
Timer 1 Run Control. This bit enables/disables the operation of Timer 1.
0 = Timer 1 is halted.
1 = Timer 1 is enabled.
Timer 0 Overflow Flag. This bit indicates when Timer 0 overflows its maximum count as defined
by the current mode. This bit can be cleared by software and is automatically cleared when the
CPU vectors to the Timer 0 interrupt service routine or by software.
0 = No Timer 0 overflow has been detected.
1 = Timer 0 has overflowed its maximum count.
Timer 0 Run Control. This bit enables/disables the operation of Timer 0.
0 = Timer 0 is halted.
1 = Timer 0 is enabled.
Interrupt 1 Edge Detect. This bit is set when an edge/level of the type defined by IT1 is detected.
If IT1 = 1, this bit r
service routine. If IT1 = 0, this bit inversely reflects the state of the INT1 pin.
Interrupt 1 Type Select. This bit selects whether the INT1 pin detects edge- or level-triggered
interrupts.
0 = INT1 is level triggered.
1
= INT1 is edge triggered.
Interrupt 0 Edge Detect. This bit is set when an edge/level of the type defined by IT0 is detected.
If IT0 = 1, this bit remains set until cleared in softwar
service routine. If IT0 = 0, this bit inversely reflects the state of the INT0 pin.
Interrupt 0 Type Select. This bit selects whether the INT0 pin detects edge- or level-triggered
interrupts.
0 = INT0 is level triggered.
1 = INT0 is edge triggered.
emains set until cleared in software or until the start of the External Interrupt 1
e or until the start of the External Interrupt 0
Maxim Integrated
4-16
M1
M0
MODE
00Mode 0: 8 bits with 5-bit prescale
01Mode 1: 16 bits
10Mode 2: 8 bits with autoreload
11Mode 3: Timer 0 is two 8-bit counters
R = Unrestricted read, W = Unrestricted write, -n = Value after reset
GATE
Bit 7
C/T
Bit 6
M1, M0
Bits 5, 4
GATE
Bit 3
C/T
Bit 2
M1, M0
Bits 1, 0
Timer 1 Gate Control. This bit enables/disables the ability of Timer 1 to increment.
0 = Timer 1 clocks when TR1 = 1, regardless of the state of INT.
1 = Timer 1 clocks only when TR1 = 1 and INT1 = 1.
Timer 1 Counter/Timer Select.
0 = Timer 1 is incremented by internal clocks.
1 = Timer 1 is incremented by pulses on T1 when TR1 (TCON.6) is 1.
Timer 1 Mode Select. These bits select the operating mode of Timer 1.
Table 4-5. Timer 1 Mode Selection
Timer 0 Gate Control. This bit enables/disables the ability of Timer 0 to increment.
0 = Timer 0 clocks when TR0 = 1, regardless of the state of INT0.
1 = Timer 0 clocks only when TR0 = 1 and INT0 = 1.
Timer 0 Counter/Timer Select.
0 = Timer incremented by internal clocks.
1 = Timer 1 is incremented by pulses on T0 when TR0 (TCON.4) is 1.
Timer 0 Mode Select. These bits select the operating mode of Timer 0. When Timer 0 is in mode
3, TL0 is star
then provided by the Timer 1 mode selection.
ted/stopped by TR0 and TH0 is started/stopped by TR1. Run control from Timer 1 is
Table 4-6. Timer 0 Mode Selection
Timer 0 LSB (TL0)
R = Unrestricted read, W = Unrestricted write, -n = Value after reset
TL0.7–0
Bits 7–0
4-17
Timer 0 LSB. This register contains the least significant byte of Timer 0.
R = Unrestricted read, W = Unrestricted write, -n = Value after reset
Ultra-High-Speed Flash
Microcontroller User’s Guide
TL1.7–0
Timer 1 LSB. This register contains the least significant byte of Timer 1.
Bits 7–0
Timer 0 MSB (TH0)
R = Unrestricted read, W = Unrestricted write, -n = Value after reset
TH0.7–0
Timer 0 MSB. This register contains the most significant byte of Timer 0.
Bits 7–0
Timer 1 MSB (TH1)
R = Unrestricted read, W = Unrestricted write, -n = Value after reset
TH1.7–0
Timer 1 MSB. This register contains the most significant byte of Timer 1.
Bits 7–0
Clock Control (CKCON)
R = Unrestricted read, W = Unrestricted write, -n = Value after reset
WD1, WD0
Bits 7, 6
Watchdog Timer Mode Select 1-0. These bits determine the watchdog timer timeout period for
the watchdog timer. The timer divides the crystal (or external oscillator) frequency by a programmable value as shown on the next page. The divider value is expressed in crystal (oscillator)
cycles. The settings of the system clock control bits 4X/2X (PMR.3) and CD1:0 (PMR.7-6) affect the
clock input to the watchdog timer and therefore its timeout period as shown below. All watchdog
timer reset timeouts follow the setting of the interrupt flag by 512 system clocks.
Table 4-7. Watchdog Interrupt Flag Timeout Periods (in Oscillator Clocks)
Timer 2 Clock Select. This bit controls the input clock that drives Timer 2. This bit has no effect
when the timer is in baud rate generator or clock output modes. See Timer Operation table.
Timer 1 Clock Select. This bit controls the input clock that drives Timer 1. See Timer Operation
table.
Timer 0 Clock Select. This bit contr
ols the input clock that drives Timer 0. See Timer Operation
table.
Table 4-8. Timer Operation (in Oscillator Clocks)
Stretch MOVX Select 2-0. These bits select the time by which external MOVX cycles are to be
stretched. This allows slower memory or peripherals to be accessed without using ports or manual software intervention. The RD or WR strobe is stretched by the specified interval, which is transparent to the software except for the increased time to execute to MOVX instruction. All internal
MOVX instructions are executed at the two machine cycle rate (0 stretch) independent of these bit
settings.
Table 4-9. MOVX Instruction
4-19
Maxim Integrated
76543210
SFR 91hIE5IE4IE3IE2CKRYRGMDRGSLBGS
RW-0RW-0RW-0RW-0R-*R-*RW-*RT-0
Port 1 (P1)
76543210
SFR 90h
P1.7
INT5
P1.6
INT4
P1.5
INT3
P1.4
INT2
P1.3
TXD1
P1.2
RXD1
P1.1
T2EX
P1.0
T2
RW-1RW-1RW-1RW-1RW-1RW-1RW-1RW-1
R = Unrestricted read, W = Unrestricted write, -n = Value after reset
Ultra-High-Speed Flash
Microcontroller User’s Guide
P1.7–0
Bits 7–0
General-Purpose I/O Port 1. This register functions as a general-purpose I/O port. In addition, all
the pins have an alternative function listed below. Each of the functions is controlled by several
other SFRs. The associated Port 1 latch bit must contain a logic 1 before the pin can be used in its
alternate function capacity.
INT5
External Interrupt 5. A falling edge on this pin causes an external interrupt 5 if enabled.
Bit 7
INT4
External Interrupt 4. A rising edge on this pin causes an external interrupt 4 if enabled.
Bit 6
INT3
External Interrupt 3. A falling edge on this pin causes an external interrupt 3 if enabled.
Bit 5
INT2
External Interrupt 2. A rising edge on this pin causes an exter
Bit 4
TXD1
Bit 3
RXD1
Bit 2
T2EX
Bit 1
Serial Port 1 Transmit. This pin transmits the serial port 1 data in serial port modes 1, 2, 3 and
emits the synchr
Serial Port 1 Receive. This pin receives the serial port 1 data in serial port modes 1, 2, 3 and is a
bidirectional data transfer pin in serial port mode 0.
Timer 2 Capture/Reload T
ters to be transferred into the captur
reload mode, a 1-to-0 transition on this pin reloads the Timer 2 registers with the value in RCAP2L
and RCAP2H if enabled by EXEN2 (T2CON.3).
T2
Bit 0
Timer 2 External Input. A 1-to-0 transition on this pin causes T
depending on the timer configuration.
External Interrupt Flag (EXIF)
nal interrupt 2 if enabled.
onizing clock in serial port mode 0.
rigger. A 1-to-0 transition on this pin causes the value in the T2 regis-
e registers if enabled by EXEN2 (T2CON.3). When in auto-
imer 2 increment or decrement bit
R = Unrestricted read, W = Unrestricted write, T = Timed-access write only, -n = Value after reset,* = See description.
IE5
Bit 7
IE4
Bit 6
IE3
Bit 5
IE2
Bit 4
Maxim Integrated
External Interrupt 5 Flag. This bit is set when a falling edge is detected on INT5. This bit must be
cleared manually by software. Setting this bit in software causes an interrupt if enabled.
External Interrupt 4 Flag. This bit is set when a rising edge is detected on INT4. This bit must be
cleared manually by software. Setting this bit in software causes an interrupt if enabled.
External Interrupt 3 Flag. This bit is set when a falling edge is detected on INT3. This bit must be
clear
ed manually by software. Setting this bit in software causes an interrupt if enabled.
External Interrupt 2 Flag. This bit is set when a rising edge is detected on INT2. This bit must be
cleared manually by software. Setting this bit in software causes an interrupt if enabled.
Clock Ready. This bit indicates the status of the startup period for the crystal oscillator or crystal
multiplier warm-up period. This bit is cleared after a reset or when exiting STOP mode. It is also
cleared when the clock multiplier is enabled (setting of PMR.4 = 1). Once CKRY is cleared, a
65,536 clock count must take place before CKRY is set and the lockout preventing modification of
CD1:CD0 is removed. Once CKRY is set (= 1), the clock multiplier can then be selected as the
clock source or switchover from the ring oscillator to the crystal oscillator can occur.
Ring Mode Status. This status bit indicates the current clock source for the device. This bit is
cleared to 0 after a power-on reset and unchanged by all other forms of reset.
0 = Device is operating from the external crystal or oscillator.
1 = Device is operating fr
Ring Oscillator Select. When set (= 1), this bit enables operation using the on-chip ring oscillator
as the clock source until the oscillator warm-up period has completed (CKRY = 1). Using the ring
oscillator to resume from stop mode allows almost instantaneous startup. This bit is cleared to 0
after a power-on reset and unchanged by all other forms of reset.
0
= Device operation is held until completion of the crystal oscillator warm-up delay period.
1 = The device begins operating from the ring oscillator and switch over to the crystal oscillator
upon completion of the warm-up delay period.
Bandgap Select. This bit enables/disables the bandgap reference during stop mode. Disabling
the bandgap reference provides significant power savings in stop mode but sacrifices the ability
to perform a power-fail interrupt or power-fail reset while stopped. This bit can only be modified with
a timed access procedure.
0 = The bandgap reference is disabled in stop mode but functions during normal operation.
1 = The bandgap reference operates in stop mode.
om the ring oscillator.
Timer and Serial Port Clock Mode Register (CKMOD)
R = Unrestricted read, W = Unrestricted write, -n = Value after reset
Bits 7, 6
T2MH
Bit 5
T1MH
Bit 4
T0MH
Bit 3
Bits 2–0
Reserved.
Timer 2 Clock Mode High-Speed Select. When set (= 1), the system clock is used as the input
clock for Timer 2, and the T2M bit (CKCON.5) setting is ignored. When clear (= 0), the input clock
for Timer 2 is selected using the T2M bit.
Timer 1 Clock Mode High-Speed Select. When set (= 1), the system clock is used as the input
clock for Timer 1, and the T1M bit (CKCON.4) setting is ignored. When clear (= 0), the input clock
for Timer 1 is selected using the T1M bit.
Timer 0 Clock Mode High-Speed Select. When set (= 1), the system clock is used as the input
clock for Timer 0, and the T0M bit (CKCON.3) setting is ignored. When clear (= 0), the input clock
for Timer 0 is selected using the T0M bit.
Reserved. Read data is 1.
4-21
Maxim Integrated
Serial Port 0 Control (SCON0)
76543210
SFR 98hSM0/FE_0SM1_0SM2_0REN_0TB8_0RB8_0TI_0RI_0
RW-0RW-0RW-0RW-0RW-0RW-0RW-0RW-0
SM0SM1SM2MO DEF U N C TIONLENG TH (BITS)PERIOD
0000Synchronous8See PMR register
0010Synchronous8See PMR register
01X1Asynchronous10Timer 1 or 2 baud rate equation
1002Asynchronous11See P MR register
1012
Asynchronous with multiprocessor
communication
11See PMR register
1103Asynchronous11Timer 1 or 2 baud rate equation
1113
Asynchronous with multiprocessor
communication
11Timer 1 or 2 baud rate equation
R = Unrestricted read, W = Unrestricted write, -n = Value after reset
Ultra-High-Speed Flash
Microcontroller User’s Guide
SM0–2
Bits 7, 6, 5
Serial Port Mode. These bits control the mode of serial port 0. In addition the SM0 and SM2_0 bits
have secondary functions as shown.
Table 4-10. Serial Port Mode Functions
SM0/FE_0
Bit 7
SM1_0
Bit 6
SM2_0
Bit 5
REN_0
Bit 4
TB8_0
Bit 3
RB8_0
Bit 2
TI_0
Bit 1
Maxim Integrated
Framing Error Flag. When SMOD0 (PCON.6) = 0, this bit is used as a mode select bit (SM0) for
serial port 0. When SMOD0 (PCON.6) = 1, this bit becomes a framing error (FE) bit, which reports
detection of an invalid stop bit. When used as FE, this bit must be cleared in software. Once the
SMOD0 bit is set, modifications to this bit do not affect the serial port mode settings. Although
accessed from the same register, the data for bits SM0 and FE are stored internally in different
physical locations.
No Alternate Function.
Multiple CPU Communications. The function of this bit is dependent on the serial port 0 mode.
Mode 0: Selects period for synchronous serial port 0 data transfers.
Mode 1: When set, r
eception is ignored (RI_0 is not set) if invalid stop bit received.
Modes 2/3: When this bit is set, multiprocessor communications are enabled in modes 2 and 3.
This prevents the RI_0 bit from being set, and an interrupt being asserted, if the 9th bit received is not 1.
Receiver Enable. This bit enables/disables the serial port 0 receiver shift r
0 = Serial por
t 0 reception disabled.
egister.
1 = Serial port 0 receiver enabled (modes 1, 2, 3). Initiate synchronous reception (mode 0).
9th Transmission Bit State. This bit defines the state of the 9th transmission bit in serial port 0
modes 2 and 3.
9th Received Bit State. This bit identifies that state of the 9th reception bit of r
ial por
t 0 modes 2 and 3. In serial port mode 1, when SM2_0 = 0, RB8_0 is the state of the stop
bit. RB8_0 is not used in mode 0.
Transmitter Interrupt Flag. This bit indicates that data in the serial port 0 buffer has been completely shifted out. In serial port mode 0, TI_0 is set at the end of the 8th data bit. In all other modes,
this bit is set at the end of the last data bit. This bit must be manually cleared by software.
eceived data in ser-
4-22
Loading...
+ 139 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.