– Stand-alone MP3 Decoder
– 48, 44.1, 32, 24, 22.05, 16 kHz Sampling Frequency
– Separated Digital Volume Control on Left and Right Channels (Software Control
using 31 Steps)
– Bass, Medium, and Treble Control (31 Steps)
– Bass Boost Sound Effect
– Ancillary Data Extraction
– CRC Error and MPEG Frame Synchronization Indicators
• Programmable Audio Output for Interfacing with Common Audio DAC
– PCM Format Compatible
– I2S Format Compatible
• 8-bit MCU C51 Core Based (F
• 2304 Bytes of Internal RAM
• 64K Bytes of Code Memory
– AT89C51SND1C: Flash (100K Eras e/Write Cycles)
– AT83C51SND1C: ROM
• 4K Bytes of Boot Flash Memory (AT89C51SND1C)
– ISP: Download from USB or UART
• USB Rev 1.1 Controller
– Full Speed Data Transmission
• Built-in PLL
– MP3 Audio Clocks
– USB Clock
• MultiMedia Card
• Atmel DataFlash
• IDE/ATAPI Interface
• 2 Channels 10-bit ADC, 8 kHz (8-true bit)
– Battery V ol tage Monitoring
– Voice Recording Controlled by Software
• Up to 44 Bits of General-purpose I/Os
– 4-bit Interrupt Keyboard Port for a 4 x n Matrix
– SmartMedia
• 2 Standard 16-bit Timers/Counters
• Hardware Watchdog Timer
• Standard Full Duplex UART with Baud Rate Generator
Single-Chip
Flash
Microcontroller
with MP3
Decoder and
Human Interface
AT83C51SND1C
AT89C51SND1C
Preliminary
Description
The AT8xC51SND1C are fully integr ated stan d-alone ha rdwired M PEG I/II-L ayer 3
decoder with a C51 microcontroller core handling data flow and MP3-player control.
The AT89C51SND1C includes 64K Bytes of Flash memory and allows In-System Programming through an embedded 4K Bytes of Boot Flash memory.
Rev. 4109E–8051–06/0 3
The AT83C51SND1C includes 64K Bytes of ROM memory.
The AT8xC51SND1C include 2304 Bytes of RAM memory.
The AT8xC51SND1C provides the necessary features for human interface like timers,
keyboard port, serial or parallel interface (USB, TWI, SPI, IDE), ADC input, I
and all external memory interface (NAND or NOR Flash, SmartMedia, MultiMedia,
DataFlash cards).
Typical Applications•MP3-Player
•PDA, Camera, Mobile Phone MP3
•Car Audio/Multimedia MP3
•Home Audio/Multimedia MP3
Block Diagram
Figure 1. AT8xC51SND1C Block Diagram
INT0INT1MOSIMISO
33
Interrupt
Handler Unit
VSSVDD
RAM
2304 Bytes
UVSSUVDD
Flash
ROM
64 KBytes
Flash Boot
4 KBytes
AVSSAVDD
AIN1:0
AREF
10-bit A to D
Converter
or
10-bit ADC
2
S output,
RXDTXD
3333444411
UART
and
BRG
T1T0
Timers 0/1
Watchdog
SS
SPI/DataFlash
Controller
SCK
SCL SDA
TWI
Controller
C51 (X2 Core)
Clock and PLL
Unit
FILTX2X1
1 Alternate function of Port 1
3 Alternate function of Port 3
4 Alternate function of Port 4
SignalsAll the AT8xC51SND1C signals are detailed by functionality in Table 1 to Table 14.
Table 1. Ports Signal Description
Signal
NameTypeDescription
Port 0
P0.7:0I/O
P1.7:0I/O
P2.7:0I/O
P3.7:0I/O
P4.7:0I/O
P0 is an 8-bit open-drain bidirectional I/O port. Port 0 pins that have 1s
written to them float and can be used as high impedance inputs. To
avoid any parasitic current consumption, floating P0 inputs must be
polarized to V
Port 1
P1 is an 8-bit bidirectional I/O port with internal pull-ups.
Port 2
P2 is an 8-bit bidirectional I/O port with internal pull-ups.
Port 3
P3 is an 8-bit bidirectional I/O port with internal pull-ups.
Port 4
P4 is an 8-bit bidirectional I/O port with internal pull-ups.
DD
Alternate
Function
AD7:0
or VSS.
KIN3:0
SCL
SDA
A15:8
RXD
TXD
INT0
INT1
T0
T1
WR
RD
MISO
MOSI
SCK
SS
P5.3:0I/O
Port 5
P5 is a 4-bit bidirectional I/O port with internal pull-ups.
Table 2. Clock Si gna l Desc r ipt ion
Signal
NameTypeDescription
Input to the on-chip inverting oscillator amplifier
X1I
X2O
FILTI
To use the internal oscillator, a crystal/resonator circuit is connected to
this pin. If an external oscillator is used, its output is connected to this
pin. X1 is the clock source for internal timing.
Output of the on-chip inverting oscillator amplifier
To use the internal oscillator, a crystal/resonator circuit is connected to
this pin. If an external oscillator is used, leave X2 unconnected.
PLL Low Pass Filter input
FILT receives the RC network of the PLL low pass filter.
-
Alternate
Function
-
-
-
6
AT8xC51SND1C
4109E–8051–06/03
Table 3. Timer 0 and Timer 1 Signal Description
AT8xC51SND1C
Signal
NameTypeDescription
Timer 0 Gate Input
serves as external run control for timer 0, when selected by
INT0
GATE0 bit in TCON register.
INT0
INT1
T0I
T1I
I
External Interrupt 0
INT0
input sets IE0 in the TCON register. If bit IT0 in this register is set,
bit IE0 is set by a falling edge on INT0#. If bit IT0 is cleared, bit IE0 is
set by a low level on INT0#.
Timer 1 Gate Input
serves as external run control for timer 1, when selected by
INT1
GATE1 bit in TCON register.
I
External Interrupt 1
INT1
input sets IE1 in the TCON register. If bit IT1 in this register is set,
bit IE1 is set by a falling edge on INT1#. If bit IT1 is cleared, bit IE1 is
set by a low level on INT1#.
Timer 0 External Clock Input
When timer 0 operates as a counter, a falling edge on the T0 pin
increments the count.
Timer 1 External Clock Input
When timer 1 operates as a counter, a falling edge on the T1 pin
increments the count.
Table 4. Audio Interface Signal Description
Alternate
Function
P3.2
P3.3
P3.4
P3.5
Signal
NameTypeDescription
DCLKODAC Data Bit Clock-
DOUTODAC Audio Data-
DSELO
SCLKO
DAC Channel Select Signal
DSEL is the sample rate clock output.
DAC System Clock
SCLK is the oversampling clock synchronized to the digital audio data
(DOUT) and the channel selection signal (DSEL).
Table 5. USB Controller Signal Description
Signal
NameTypeDescription
D+I/O
D-I/OUSB Negative Data Upstream Port-
USB Positive Data Upstream Port
This pin requires an external 1.5 KΩ pull-up to V
operation.
for full speed
DD
Alternate
Function
-
-
Alternate
Function
-
4109E–8051–06/03
7
Table 6. MutiMediaCard Interface Signal Description
Signal
NameTypeDescription
MCLKO
MCMDI/O
MDATI/O
MMC Clock output
Data or command clock transfer.
MMC Command line
Bidirectional command channel used for card initialization and data
transfer commands. To avoid any parasitic current consumption,
unused MCMD input must be polarized to V
MMC Data line
Bidirectional data channel. To avoid any parasitic current consumption,
unused MDAT input must be polarized to V
Table 7. UART Signal Description
Signal
NameTypeDescription
Receive Serial Data
RXDI/O
TXDO
RXD sends and receives data in serial I/O mode 0 and receives data in
serial I/O modes 1, 2 and 3.
Transmit Serial Data
TXD outputs the shift clock in serial I/O mode 0 and transmits data in
serial I/O modes 1, 2 and 3.
DD
or VSS.
DD
Alternate
Function
-
-
or VSS.
-
Alternate
Function
P3.0
P3.1
Table 8. SPI Controller Signal Description
Signal
NameTypeDescription
MISOI/O
MOSII/O
SCKI/O
SS
SPI Master Input Slave Output Data Line
When in master mode, MISO receives data from the slave peripheral.
When in slave mode, MISO outputs data to the master controller.
SPI Master Output Slave Input Data Line
When in master mode, MOSI outputs data to the slave peripheral.
When in slave mode, MOSI receives data from the master controller.
SPI Clock Line
When in master mode, SCK outputs clock to the slave peripheral. When
in slave mode, SCK receives clock from the master controller.
SPI Slave Select Line
I
When in controlled slave mode, SS
Table 9. TWI Controller Signal Description
Signal
NameTypeDescription
TWI Serial Clock
SCLI/O
When TWI controller is in master mode, SCL outputs the serial clock to
the slave peripherals. When TWI controller is in slave mode, SCL
receives clock from the master controller.
enables the slave mode.
Alternate
Function
P4.0
P4.1
P4.2
P4.3
Alternate
Function
P1.6
SDAI/O
8
AT8xC51SND1C
TWI Serial Data
SDA is the bidirectional Two Wire data line.
P1.7
4109E–8051–06/03
Table 10. A/D Converter Signal Description
AT8xC51SND1C
Signal
NameTypeDescription
AIN1:0IA/D Converter Analog Inputs-
AREFPIAnalog Positive Voltage Reference Input-
AREFNI
Analog Negative Voltage Reference Input
This pin is internally connected to AVSS.
Table 11. Keypad Interface Signal Description
Signal
NameTypeDescription
KIN3:0I
Keypad Input Lines
Holding one of these pins high or low for 24 oscillator periods triggers a
keypad interrupt.
Table 12. External Access Signal Description
Signal
NameTypeDescription
Address Lines
A15:8I/O
Upper address lines for the external bus.
Multiplexed higher address and data lines for the IDE interface.
Alternate
Function
-
Alternate
Function
P1.3:0
Alternate
Function
P2.7:0
AD7:0I/O
ALEO
ISP
RD
WR
I/O
O
O
Address/Data Lines
Multiplexed lower address and data lines for the external memory or the
IDE interface.
Address Latch Enable Output
ALE signals the start of an external bus cycle and indicates that valid
address information is available on lines A7:0. An external latch is used
to demultiplex the address from address/data bus.
ISP Enable Input AT89C51SND1C Only
This signal must be held to GND through a pull-down resistor at the
falling reset to force execution of the internal bootloader.
Read Signal
Read signal asserted during external data memory read operation.
Write Signal
Write signal asserted during external data memory write operation.
P0.7:0
-
-
P3.7
P3.6
4109E–8051–06/03
9
Table 13. System Signal Description
Signal
NameTypeDescription
Reset Input
Holding this pin high for 64 oscillator periods while the oscillator is
running resets the device. The Port pins are driven to their reset
conditions when a voltage lower than V
RST I
TST
oscillator is running.
This pin has an internal pull-down resistor which allows the device to be
reset by connecting a capacitor between this pin and V
Asserting RST when the chip is in Idle mode or Power-Down mode
returns the chip to normal operation.
Test Input
I
Tes t mode entry signal. This pin must be set to V
Notes: 1. For information on resistors value, input/output levels, and drive capability, refer to
the Section “DC Characteristics”, page 181.
2. When the Two Wire controller is enabled, P
, P2, and P3 transistors are disabled
1
allowing pseudo open-drain structure.
3. In Port 2, P1 transistor is continuously driven when outputting a high level bit address
(A15:8).
4109E–8051–06/03
11
Clock ControllerThe AT8xC51SND1C clock controller is based on an on-chip oscillator feeding an on-
chip Phase Lock Loop (PLL). All internal clocks to the peripherals and CPU core are
generated by this controller.
OscillatorThe AT8xC51SND1C X1 and X2 pins are the input and the output of a single -stage on-
chip inverter (see Figure 5) that can be configured with off-chip components such as a
Pierce oscillator (see Figure 6). Value of capacitors and crystal characteristics are
detailed in the section “DC Characteristics”.
The oscillator outputs three different clocks: a clock for the PLL, a clock for the CPU
core, and a clock for the per ipherals as shown in Figu re 5. These clocks are either
enabled or disabled, de pendin g on th e power red uctio n mode as detailed in the sec tion
“Power Management” on page 46. The peripheral clock is used to generate the Timer 0,
Timer 1, MMC, ADC, SPI, and Port sampling clocks.
Figure 5. Oscillator Block Diagram and Symbol
CPU
0
1
X2
CKCON.0
Peripheral
Clock
CPU Core
Clock
IDL
PCON.0
Oscillator
Clock
OSC
CLOCK
Oscillator Clock Symbol
X1
X2
PD
PCON.1
PER
CLOCK
Peripheral Clock Symbol
÷2
CLOCK
CPU Core Clock Symbol
Figure 6. Crystal Connection
X1
C1
Q
C2
VSS
X2
X2 FeatureUnlike standard C51 products that require 12 oscillator clock periods per machine cycle,
the AT8xC51SND1C need only 6 oscillator clock periods per machine cycle. This feature called the “X2 feature” can be enabl ed usin g the X2 b it
and allows the AT8x C51SND1C to operate in 6 or 12 oscillator cloc k periods per
machine cycle. As shown in Figure 5, both CPU and peripheral clocks are affected by
this feature. Figure 7 shows the X2 mode switching waveforms. After reset the standard
mode is activated. In standard mode the CPU and peripheral clock frequency is the
oscillator frequency divided by 2 while in X2 mode, it is the oscillator frequency.
(1)
in CKCON (see Table 16)
12
Note:1. The X2 bit reset value depends on the X2B bit in the Hardware Security Byte (see
Table 22 on page 22). Using the AT89C51SND1C (Flash Version) the system can
boot either in standard or X2 mode depending on the X2B value. Using
AT83C51SND1C (ROM Version) the system always boots in standard mode. X2B bit
can be changed to X2 mode later by software.
AT8xC51SND1C
4109E–8051–06/03
Figure 7. Mode Switching Waveforms
X1
X1 ÷ 2
X2 Bit
Clock
AT8xC51SND1C
STD ModeSTD Mode
Note:1. In order to prevent any incorrect operation while operating in X2 mode, user must be
aware that all peripherals using clock frequency as time reference (timers, etc.) will
have their time reference divided by 2. For example, a free running timer generating
an interrupt every 20 ms will then generate an interrupt every 10 ms.
X2 Mode
(1)
PLL
PLL DescriptionThe AT8xC51SND1C PLL is us ed to generate internal hi gh frequency clo ck (the PLL
Clock) synchronized with an ex ternal low-frequency (the O scillator Clock). The P LL
clock provides the MP3 decoder, the audi o interface, and the USB interface cl ocks.
Figure 8 shows the internal structure of the PLL.
The PFLD block is the Phase Frequency Comparator and Lock Detector. This block
makes the comparison between the reference clock coming from the N divider and the
reverse clock coming from the R divider and generates some pulses on the Up or Down
signal dependin g on the edge posi tion of the r everse c lock. The P LLEN bit in PLLCO N
register is used to enab le the c lock gene ratio n. When the PLL is l ocked, th e bit PL OCK
in PLLCON register (see Table 17) is set.
The CHP block is the Charge Pump that generates the voltage reference for the VCO by
injecting or extracting charges from the exter nal filte r connected on PFILT pin (see
Figure 9). Value of the filter components are detailed in the Section “DC
Characteristics”.
4109E–8051–06/03
The VCO block is the Voltage Controlled Oscillator controlled by the voltage V
duced by the charge pump. It generates a square wave signal: the PLL clock.
PLL ProgrammingThe PLL is programmed using the flow shown in Figure 10. As soon as clock generation
is enabled, the user must wait until the lo ck indic ator is set to ens ure the cl ock output is
stable. The PLL clock fr equenc y will dep end on MP 3 deco der cloc k and au dio int erfac e
clock frequencies.
Figure 10. PLL Programming Flow
PLL
Programming
Configure Dividers
N6:0 = xxxxxxb
R9:0 = xxxxxxxxxxb
Enable PLL
PLLRES = 0
PLLEN = 1
PLL Locked?
PLOCK = 1?
14
AT8xC51SND1C
4109E–8051–06/03
RegistersTable 16. CKCON Register
CKCON (S:8Fh) – Clock Control Register
76543210
-WDX2---T1X2T0X2X2
AT8xC51SND1C
Bit
Number
7-
6WDX2
5 - 3-
2T1X2
1T0X2
0X2
Bit
Mnemonic Description
Reserved
The value read from this bit is indeterminate. Do not set this bit.
Watchdog Clock Control Bit
Set to select the oscillator clock divided by 2 as watchdog clock input (X2
independent).
Clear to select the peripheral clock as watchdog clock input (X2 dependent).
Reserved
The values read from these bits are indeterminate. Do not set these bits.
Timer 1 Clock Control Bit
Set to select the oscillator clock divided by 2 as timer 1 clock input (X2
independent).
Clear to select the peripheral clock as timer 1 clock input (X2 dependent).
Timer 0 Clock Control Bit
Set to select the oscillator clock divided by 2 as timer 0 clock input (X2
independent).
Clear to select the peripheral clock as timer 0 clock input (X2 dependent).
System Clock Control Bit
Clear to select 12 clock periods per machine cycle (STD mode, F
/2).
F
OSC
Set to select 6 clock periods per machine cycle (X2 mode, F
CPU
CPU
= F
= F
PER
Reset Value = 0000 000Xb (AT89C51SND1C) or 0000 0000b (AT83C51SND1C)
Table 17. PLLCON Register
PLLCON (S:E9h) – PLL Control Register
= F
PER
=
OSC
).
4109E–8051–06/03
76543210
R1R0--PLLRES-PLLENPLOCK
Bit
Number
7 - 6R1:0
5 - 4-
3PLLRES
2-
1PLLEN
0PLOCK
Bit
Mnemonic Description
PLL Least Significant Bits R Divider
2 LSB of the 10-bit R divider.
Reserved
The values read from these bits are always 0. Do not set these bits.
PLL Reset Bit
Set this bit to r e set the PLL.
Clear this bit to free the PLL and allow enabling.
Reserved
The value read from this bit is always 0. Do not set this bit.
PLL Enable Bit
Set to enable the PLL.
Clear to disable the PLL.
PLL Lock Indicator
Set by hardware when PLL is locked.
Clear by hardware when PLL is unlocked.
Reset Value = 0000 1000b
15
Table 18. PLLNDIV Register
PLLNDIV (S:EEh) – PLL N Divider Register
76543210
- N6N5N4N3N2N1N0
Bit
Number
7-
6 - 0N6:0
Bit
Mnemonic Description
Reserved
The value read from this bit is always 0. Do not set this bit.
The AT8xC51SND1C implement 64K Bytes of on-chip program/c ode memory.
Figure 11 shows the split of internal and external program/code memory spaces
depending on the product.
The AT83C51SND1C product provides the internal program/code memory in ROM
memory while the AT89C51S ND1 C pr odu ct p ro vides it in F la sh memo r y. The se 2 products do not allow external code memory execution.
The Flash memory increa ses EP ROM and ROM func tional ity by in-cir cui t electric al erasure and programming. The high voltage needed for programming or erasing Flash cells
is generated on-chip using the standard V
charge pump. Thus, the AT89C51SND1C can be programmed using only one voltage
and allows In-application software programming. Hardware programming mode is also
available using common programming tools. See the application note ‘Programming
T89C51x and AT89C51x with Device Programmers’.
The AT89C51SND1C implements an additional 4K Bytes of on-chip boot Flash memory
provided in Fla sh memor y. Thi s bo ot memo ry is deli vered p rogr ammed with a stand ard
boot loader so ftware allowi ng In-System Programm ing (ISP). It also con tains som e
Application Prog rammin g Interface r outines named API ro utines allo wing In Appl icatio n
Programming (IAP) by using user’s own boot loader.
Figure 11. Program/Code Memory Organization
FFFFh
FFFFh
F000h
voltage, made possible by the internal
DD
FFFFh
F000h
4K Bytes
Boot Flash
64K Bytes
Code ROM
0000h
AT83C51SND1C
ROM Memory
Architecture
As shown in Figure 11 the AT83C51SND1C ROM memory is composed of one space
detailed in the following paragraphs.
Figure 12. AT83C51SND1C Memory Architecture
FFFFh
0000h
64K Bytes
ROM Memory
64K Bytes
Code Flash
AT89C51SND1C
User
4109E–8051–06/03
0000h
17
User SpaceThis space is composed of a 64K Bytes ROM memory programmed during the manu-
facturing process. It contains the user’s application code.
Flash Memory
Architecture
As shown in Figure 13 the AT89C51 SND1C Flas h memor y is compos ed of four spac es
detailed in the following paragraphs.
Figure 13. AT89C51SND1C Memory Architecture
Hardware Security
FFFFh
64K Bytes
Flash Memory
0000h
Extra Row
User
FFFFh
F000h
4K Bytes
Flash Memory
Boot
User SpaceThis space is composed of a 64K Bytes Flash memory organized in 512 pages of 128
Bytes. It contains the user’s application code.
This space can be read or written by both software and hardware modes.
Boot SpaceThis spa ce is composed of a 4K Bytes F l ash m emory. It contains the b oot lo ader f or In-
System Programming and the routines for In Application Programming.
This space can only be read or wr itt en by hardwa re mode using a par all el progr am min g
tool.
Hardware Security SpaceThis space is composed of one Byte: the Hardware Security Byte (HSB see Table 22)
divided in 2 separ ate n ibble s. The MSN conta ins the X2 mo de con figur ation bit an d the
Boot Loader Jump Bit as detailed in Section “Boot Memory Execution”, page 19 and can
be written by software while the LS N co nta ins the l oc k system lev el to pro tec t the memory content against piracy as detailed in Section “Hardware Security System”, page 19
and can only be written by hardware.
Extra Row SpaceThis space is composed of 2 Bytes:
•The Software Boot Vector (SBV, see Table 23).
This Byte is used by the software boot loader to build the boot address.
•The Software Security Byte (SSB, see Table 24).
This Byte is used to lock the execution of some boot loader commands.
18
AT8xC51SND1C
4109E–8051–06/03
AT8xC51SND1C
Hardware Security
System
The AT89C51SND1C implem ents three lock bits LB2:0 in the LSN of HSB ( see
Table 22) providing three levels of se curity for user ’s program as descri bed i n Ta ble 2 2
while the AT83C51SND1C is always set in read disabled mode.
Level 0 is the level of an erased part and does not enable any security feature.
Level 1 locks the hardware programming of both user and boot memories.
Level 2 locks also hardware verifying of both user and boot memories
Level 3 locks also the external execution.
Notes: 1. U means unprogrammed, P means programmed and X means don’t care (pro-
(2)
LB1 LB0
PXXEnableDis ableDisableDisableEnable
grammed or unprogrammed).
2. LB2 is not implemented in the AT8xC51SND1C products.
3. AT89C51SND1C products are delivered with third level programmed to ensure that
the code programmed by software using ISP or user’s boot loader is secured from
any hardware piracy.
(1)
Internal
Execution
External
Execution
Hardware
Verifying
Hardware
Programming
Software
Programming
Boot Memory ExecutionAs internal C51 code space is limited to 64K Bytes, some mechanisms are implemented
to allow boot memory to be mapped in the code space for ex ecution at addre sses from
F000h to FFFFh. The boot memory is enabled by setting the ENBOOT bit in AUXR1
(see Figure 21). The three ways to set this bit are detailed in the following sections.
Software Boot MappingThe software way to set ENBOOT consists in writing to AUXR1 from the user’s soft-
ware. This enables boot loader or API routines execution.
Hardware Condition Boot
Mapping
The hardware condition is based on the ISP
pin. When driving this pin to low level, the
chip reset sets ENBOOT and for ce s the res et vector to F000 h ins te ad of 00 00h i n order
to execute the boot loader software.
As shown in Figure 14 the hardware condition always allows in-system recovery when
user’s memory has been corrupted.
Programmed Condition Boot
Mapping
The programmed con dition is based on the Boot Loader Ju mp Bit (BLJB) in HSB. As
shown in Figure 14 when this bit is programmed (by hardware or software programming
mode), the chip reset set ENBOOT and forces the reset vec tor to F000h instead of
0000h, in order to execute the boot loader software.
4109E–8051–06/03
19
Figure 14. Hardware Boot Process Algorithm
RESET
Hard Cond?
ISP = L?
Preventing Flash
Corruption
HardwareSoftware
ProcessProcess
Standard Init
ENBOOT = 0
PC = 0000h
FCON = F0h
User’s
Application
Prog Cond?
BLJB = P?
Prog Cond Init
ENBOOT = 1
PC = F000h
FCON = F0h
Atmel’s
Boot Loader
Hard Cond Init
ENBOOT = 1
PC = F000h
FCON = 00h
The software process (boot loader) is detailed in the “Boot Loader Datasheet”
Document.
See Section “Reset Recommendation to Prevent Flash Corruption”, page 47.
20
AT8xC51SND1C
4109E–8051–06/03
RegistersTable 21. AUXR1 Register
AUXR1 (S:A2h) – Auxiliary Register 1
76543210
--ENBOOT-GF30-DPS
AT8xC51SND1C
Bit
Number
7 - 6-
5ENBOOT
4-
3GF3
20
1-Reserved for Data Pointer Extension.
0DPS
Bit
Mnemonic Description
Reserved
The value read from these bits are indeterminate. Do not set these bits.
Enable Boot Flash
Set this bit to map the boot Flash in the code space between at addresses F000h
1
to FFFFh.
Clear this bit to disable boot Flash.
Reserved
The value read from this bit is indeterminate. Do not set this bit.
General Flag
This bit is a general-purpose user flag.
Always Zero
This bit is stuck to logic 0 to allow INC AUXR1 instruction without affecting GF3
flag.
Data Pointer Select Bit
Set to select second data pointer: DPTR1.
Clear to select first data pointer: DPTR0.
Reset Value = XXXX 00X0b
Note:1. ENBOOT bit is only ava il abl e in AT89C51SND1C product.
2. The external space.
A fourth internal segment is available but dedicated to Special Function Registers,
SFRs, (addresses 80h to FFh) accessible by direct addressing mode. For information
on this segment, refer to the Section “Special Function Registers”, page 30.
Figure 15 shows the internal and external data memory spaces organization.
Figure 15. Internal and External Data Memory Organization
FFFFh
64K Bytes
External XRAM
7FFhFFh
00h
2K Bytes
Internal ERAM
EXTRAM = 0
80h80h
7Fh
00h
Upper
128 Bytes
Internal RAM
Indirect Addressing
Lower
128 Bytes
Internal RAM
Direct or Indirect
Addressing
FFh
Direct Addressing
Special
Function
Registers
0800h
0000h
EXTRAM = 1
Internal Space
Lower 128 Bytes RAMThe lower 128 Bytes of RAM (see Figure 16) are accessibl e from address 00h to 7Fh
using direct or indirect address ing modes. T he lowest 32 Bytes are grouped in to 4
banks of 8 registers (R0 to R7). 2 bits RS0 and RS1 in PSW register (see Table 28)
select which bank is in use according to Table 25. This allows more efficient use of code
space, since register instructions are shorter than instructions that use direct addressing, and can be used for context switching in interrupt service routines.
Table 25. Register Bank Selection
RS1RS0Description
00Register bank 0 from 00h to 07h
4109E–8051–06/03
01Register bank 1 from 08h to 0Fh
10Register bank 2 from 10h to 17h
11Register bank 3 from 18h to 1Fh
The next 16 Bytes above the register banks form a block of bit-addressable memory
space. The C51 instruction set includes a wide selection of single-bit instructions, and
the 128 bits in this area can be directly addressed by these instructions. The bit
addresses in this area are 00h to 7Fh.
Upper 128 Bytes RAMThe upper 128 Bytes of RAM are accessible from address 80h to FFh using only indirect
addressing mode.
Expanded RAMThe on-chip 2K Bytes of expa nded RAM (E RAM ) are acces s ible fr om a ddr ess 0 000h to
07FFh using i ndirect ad dressing mode thro ugh MOVX in structio ns. In this a ddress
range, EXTRAM bit in AUXR register (see Table 29) is used to select the ERAM
(default) or the XRAM. As shown in Figure 15 when EXTRAM = 0, the ERAM is selected
and when EXTRAM = 1, the XRAM i s selected (see Section “Extern al Sp ace ”).
The ERAM memo ry can be resiz ed using XRS1: 0 bits in AUXR re gister to dynam ically
increase externa l ac cess to the XRAM spac e. T able 2 6 detai ls the s elec ted ER AM size
and address range.
Table 26. ERAM Size Selection
XRS1XRS0ERAM SizeAddress
00256 Bytes0 to 00FFh
01512 Bytes0 to 01FFh
101K Byte0 to 03FFh
112K Bytes0 to 07FFh
Note:Lower 128 Bytes RAM, Upper 128 Bytes RAM, and expanded RAM are made of volatile
memory cells. This means that the RAM content is indeterminate after power-up and
must then be initialized properly.
24
AT8xC51SND1C
4109E–8051–06/03
AT8xC51SND1C
External Space
Memory Interfac eThe external memory interface comprises the external bus (port 0 and port 2) as well as
the bus control signals (RD
Figure 17 shows the structure of the external address bus. P0 carries address A7:0
while P2 carries address A15:8. Data D7:0 is multiplexed with A7:0 on P0. Table 27
describes the external memory interface signals.
Figure 17. External Data Memory Interface Structure
, WR, and ALE).
AT8xC51SND1C
AD7:0
A15:8
Latch
A7:0
P2
ALE
P0
WR
Table 27. External Data Memory Interface Signals
Signal
NameType Description
A15:8O
AD7:0I/O
ALEO
RD
Address Lines
Upper address lines for the external bus.
Address/Data Lines
Multiplexed lower address lines and data for the external memory.
Address Latch Enable
ALE signals indicates that valid address information are available on lines
AD7:0.
Read
O
Read signal output to external data memory.
RAM
PERIPHERAL
A15:8
A7:0
D7:0
OERD
WR
Alternate
Function
P2.7:0
P0.7:0
-
P3.7
WR
O
Write signal output to external memory.
P3.6
Write
Page Access ModeThe AT8xC51SND1C im plemen t a feature called Pag e Access that dis ables the out put
of DPH on P2 wh en execut ing MO VX @DP TR instru ction. P age Ac cess is enable by
setting the DPHDIS bit in AUXR register.
Page Access is useful when appli cation uses both ERAM and 256 Bytes of XRAM. In
this case, software modifies intensively EXTRAM bit to select access to ERAM or XRAM
and must save it if used in interrupt service routine. Page Access allows external access
above 00FFh address with out generating DP H on P2. Thus ERAM is accessed u sing
MOVX @Ri or MOVX @DPTR with DPTR < 0100h, and XRAM is accessed using
MOVX @DPTR with DPTR ≥ 0100h while keeping P2 for general I/O usage.
25
4109E–8051–06/03
External Bus CyclesThis s ection describes the bus cycles the AT 8xC51SND1C executes to read (see
Figure 18), and write data (see Figure 19) in the external data memory.
External memory cycle takes 6 CPU clock periods. This is equivalent to 12 oscillator
clock period in standard mode or 6 oscillator clock periods in X2 mode. For further information on X2 mode, refer to the Section “X2 Feature”, page 12.
Slow peripherals can be acc essed b y stretc hing th e read and write cycles . This is done
using the M0 bit in AUXR reg ister. S etting t his bi t changes the widt h of the RD
and WR
signals from 3 to 15 CPU clock periods.
For simplicity, Figure 18 and Figure 19 depict the bus cycle waveforms in idealized form
and do not provide precis e timing in forma tion. For bus cycl e timing p aramet ers refe r to
the Section “AC Characteristics”.
Figure 18. External Data Read Waveforms
CPU Clock
ALE
(1)
RD
P0
P2
Notes: 1. RDsignal may be stretched using M0 bit in AUXR register.
3. When executing MOVX @DPTR instruction, if DPHDIS is set (Page Access Mode),
P2
P2 outputs SFR content instead of DPH.
DPL or RiD7:0
DPH or P2
(2),(3)
26
AT8xC51SND1C
4109E–8051–06/03
AT8xC51SND1C
Dual Data Pointer
DescriptionThe AT8xC51SND1C impl ement a se cond data po int er for spe eding up cod e execu tion
and reducing code size in case of intensive usage of external memory accesses.
DPTR0 and DPTR1 ar e seen by the CPU as DPTR and a re access ed using t he SFR
addresses 83h and 84h that are the DPH and DPL addresses. The DPS bit in AUXR1
register (see Table 21 ) is used to se lect whet her DPTR is the data poin ter 0 or the da ta
pointer 1 (see Figure 20).
Figure 20. Dual Data Pointer Implementation
DPL0
DPL1
DPTR0
DPTR1
DPH0
DPH1
0
1
DPS
0
1
DPL
AUXR1.0
DPH
DPTR
ApplicationSoftware can take advantage of the additional data pointers to both increase speed and
reduce code size, for example, block operations (copy, compare, search …) are well
served by using one data pointe r as a “source” pointer and the oth er one as a “destina-
tion” pointer.
Below is an example of block move implementation using the 2 pointers and coded in
assembler. T he latest C compi ler also takes ad vantage of this feature by provid ing
enhanced algorithm libraries.
The INC instruction is a short (2 Bytes) and fast (6 CPU clocks) way to manipulate the
DPS bit in the AUXR 1 reg ister. H owever , note that th e INC i nstruc tion do es no t direc tly
force the DPS bit to a particular state, but simply toggles it. In simple routines, such as
the block move exa mple, o nly the f act that DP S is tog gled i n the pr oper s equenc e matters, not its actual value. In other words, the block move routine works the same whether
DPS is '0' or '1' on entry.
4109E–8051–06/03
; ASCII block move using dual data pointers
; Modifies DPTR0, DPTR1, A and PSW
; Ends when encountering NULL character
; Note: DPS exits opposite of entry state unless an extra INC AUXR1 is added
AUXR1EQU0A2h
move:movDPTR,#SOURCE ; address of SOURCE
incAUXR1 ; switch data pointers
movDPTR,#DEST ; address of DEST
mv_loop: incAUXR1; switch data pointers
movx A,@DPTR; get a Byte from SOURCE
incDPTR; increment SOURCE address
incAUXR1; switch data pointers
movx @DPTR,A; write the Byte to DEST
incDPTR; increment DEST address
jnzmv_loop; check for NULL terminator
end_move:
27
RegistersTable 28. PSW Register
PSW (S:8Eh) – Program Status Word Register
76543210
CYACF0RS1RS0OVF1P
Bit
Number
7CY
6AC
5F0User Definable Flag 0
4 - 3RS1:0
2OV
1F1User Definable Flag 1
0P
Bit
Mnemonic Description
Carry Flag
Carry out from bit 1 of ALU operands.
Auxiliary Carry Flag
Carry out from bit 1 of addition operands.
Register Bank Select Bits
Refer to Table 25 for bits description.
Overflow Flag
Overflow set by arithmetic operations.
Parity Bit
Set when ACC contains an odd number of 1’s.
Cleared when ACC contains an even number of 1’s.
Reset Value = 0000 0000b
28
AT8xC51SND1C
4109E–8051–06/03
AT8xC51SND1C
Table 29. AUXR Register
AUXR (S:8Eh) – Auxiliary Control Register
76543210
-EXT16M0DPHDISXRS1XRS0EXTRAMAO
Bit
Number
7-
6EXT16
5M0
4DPHDIS
3 - 2XRS1:0
1EXTRAM
0AO
Bit
Mnemonic Description
Reserved
The value read from this bit is indeterminate. Do not set this bit.
External 16-bit Access Enable Bit
Set to enable 16-bit access mode during MOVX instructions.
Clear to disable 16-bit access mode and enable standard 8-bit access mode
during MOVX instructions.
External Memory Access Stretch Bit
Set to stretch RD
Clear not to stretch RD
DPH Disable Bit
Set to disable DPH output on P2 when executing MOVX @DPTR instruction.
Clear to enable DPH output on P2 when executing MOVX @DPTR instruction.
Expanded RAM Size Bits
Refer to T able26 for ERAM size description.
External RAM Enable Bit
Set to select the external XRAM when executing MOVX @Ri or MOVX @DPTR
instructions.
Clear to select the internal expanded RAM when executing MOVX @Ri or MOVX
@DPTR instructions.
ALE Output Enable Bit
Set to output the ALE signal only during MOVX instructions.
Clear to output the ALE signal at a constant rate of F
or WR signals duration to 15 CPU clock periods.
or WR signals and set duration to 3 CPU clock periods.
/3.
CPU
4109E–8051–06/03
Reset Value = X000 1101b
29
Special Function
Registers
The Special Function Registers (SFRs) of the AT8xC51SND1C derivatives fall into the
categories detailed in Table 30 to Table 46. The relative addresses of these SFRs are
provided together with their reset values in Table 47. In this table, the bit-addressable
registers are identified by Note 1.
Table 30. C51 Core SFRs
MnemonicAddName76543210
ACCE0h Accumulator
BF0h B Register
PSWD0h Program Status WordCYACF0RS1RS0OVF1P
SP81h Stack Pointer
DPL82h Data Pointer Low Byte
DPH83h Data Pointer High Byte
Note:1. ENBOOT bit is only available in AT89C51SND1C product.
Table 32. PLL and System Clock SFRs
MnemonicAddName76543210
CKCON8FhClock Control-------X2
PLLCONE9h PLL ControlR1R0--PLLRES-PLLENPLOCK
PLLNDIVEEh PLL N Divider-N6N5N4N3N2N1N0
PLLRDIVEFh PLL R DividerR9R8R7R6R5R4R3R2
Table 33. Interrupt SFRs
MnemonicAddName76543210
IEN0A8h Interrupt Enable Control 0EAEAUDEMP3ESET1EX1ET0EX0
IEN1B1h Interrupt Enable Control 1-EUSB-EKBEADCESPIEI2CEMM C
IPH0B7h Interrupt Priority Control High 0-IPHAUDIPHMP3IPHSIPHT1IPHX1IPHT0IPHX0
IPL0B8h Interrupt Priority Control Low 0-IPLAUDIPLMP3IPLSIPLT1I PLX 1IPLT0IPLX0
IPH1B3h Interrupt Priority Control High 1-IPHUSB-IPHKBIPHADCIPHSPIIPHI2CIPHMMC
IPL1B2h Interrupt Priority Control Low 1-IPLUSB-IPLKBIPLADCIPLSPIIPLI2CIPLMMC
30
AT8xC51SND1C
4109E–8051–06/03
Loading...
+ 180 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.