- High Performance and Low Power RISC Architecture
•
118 Powerful Instructions - Most Single Clock Cycle Execution
•
4K bytes of In-System Reprogrammable Flash
– SPI Serial Interface for Program Downloading
– Endurance: 1,000 Write/Eras e Cycles
•
256 bytes EEPROM
– Endurance: 100,000 Write/Erase Cycles
•
256 bytes Internal SRAM
•
32 x 8 General Purpose Working Registers
•
32 Programmable I/O Lines
•
Programmable Serial UART
•
SPI Serial Interface
•
VCC: 2.7 - 6.0V
•
Fully Static Operation
– 0 - 8 MHz, 4.0 - 6.0V
– 0 - 4 MHz, 2.7 - 4.0V
•
Up to 8 MIPS Throughput at 8 MHz
•
One 8-Bit Timer/Counter with Separate Prescaler
•
One 16-Bit Timer/Counter with Separate Prescaler
and Compare and Capture Modes
•
Dual PWM
•
External and Internal Interrupt Sources
•
Programmable Watchdog Timer with On-Chip Oscillator
•
On-Chip Analog Comparator
•
Low Power Idle and Power Down Modes
•
Programming Lock for Software Security
8-Bit
Microcontr oller
with 4K bytes
In-System
Programmable
Flash
AT90S4414
Description
The AT90S4414 is a low-power CMOS 8-bit microcontroller based on the AVR
enhanced RISC architecture . By exe cuting powe rful instruc tions in a single clock
cycle, the AT90S4414 achieves throughpu ts approaching 1 MIPS per MHz allowing
the system designer to optimize power consumption versus processing speed.
The AVR core is based on an enhanced RISC architecture that combines a rich
instruction set w ith 32 gener al purpose working regis ters. All the 32 registe rs are
directly connected to the A rithmetic Logic Unit (ALU ), all owi ng two independent registers to be accessed in one single instruction executed in one clock cycle. The resulting
architecture is more code efficient while achieving throughputs up to ten times faster
than conventional CISC microcontrollers.
(continued)
Pin Configurations
Preliminary
Rev. 0840DS–07/98
Note: This is a summary document. For the complete 76 page
datasheet, please visit our web site at
literature@atmel.com
mail at
and request literature #0840D.
www.atmel.com
or e-
1
Page 2
Block Diagram
Figure 1.
The AT90S4414 Block Diagram
The AT90S4414 provides the following features: 4K bytes
of In-System Programmable Flash, 256 bytes EEPROM,
256 bytes SRAM, 32 gen eral purpo se I/O li nes, 3 2 general
purpose working registers, flexible timer/counters with
compare modes, internal and external interrupts, a programmable serial UART, programmable Watchdog Timer
with internal oscillator, an SPI serial port and two software
selectable pow er saving modes. T he Idl e Mode sto ps the
CPU while allowing the SRAM, timer/counters, SPI port
and interrupt syste m to contin ue functioning . The power
down mode saves the register contents but freezes the
oscillator, disabling all other chip functions until the next
interrupt or hardware reset.
2
AT90S4414
The device is manufac tured using Atmel’ s high density
non-volatile m emory tech nology. The on-chip In-S ystem
Programmable Flash allows the program memory to be
reprogrammed in-sys tem th ro ugh an S PI se rial i nterface or
by a conventional n onvolatile memo ry programmer. By
combining an enhanced RISC 8-bit CPU wit h In-System
Programmable Flash on a monolithic chip, the Atmel
AT90S4414 is a powerful microcontroller that provides a
highly flexible and co st effect ive solution to many em bedded control applications.
AVR
The AT90S4414
gram and system development tools including: C compilers, macro assemblers, program debugger/si mulators, incircuit emulators, and evaluati on kits.
is supported with a full suite of pro-
Page 3
AT90S4414
Pin Descriptions
VCC
Supply voltage
GND
Ground
Port A (PA7..PA0
Port A is an 8 -bit b idirec tional I/O port. Port p ins ca n provide internal pull-up resistors (selected for each bit). The
Port A output buffers can sink 20mA and can drive LED displays directly. When pins PA0 to PA7 are used as inputs
and are externally pull ed low, they will source c urrent if the
internal pull-up resistors are activated.
Port A serves as Multiplexed Address/Data input/output
when using external SRAM.
Port B (PB7..PB0)
Port B is an 8-bit bidirectional I/O pins with internal pull-up
resistors. The Port B output buffers can sink 20 mA. As
inputs, Port B pins t hat a re ex ter nally pu ll ed l ow wi ll sour c e
current if the pull-up resistors are activated.
Port B also serves the fu nction s of vario us speci al feat ures
of the AT90S4414 as listed on page 45.
Port C (PC7..PC0)
Port C is an 8-bit bidirectional I/O port with internal pull-up
resistors. The Port C output buffers can sink 20 mA. As
inputs, Port C pins that are exter nal ly pul led low wil l sour ce
current if the pull-up resistors are activated.
Port C als o s erv es as Addr es s ou tp ut when us ing ext ern al
SRAM.
Port D (PD7..PD0)
Port D is an 8-bit bidirectional I/O port with internal pull-up
resistors. The Port D output buffers can sink 20 mA. As
inputs, Port D pins that are exter nal ly pul led low wil l sour ce
current if the pull-up resistors are activated.
Port D also serves th e fu nc tion s of v ario us sp ec ial fea tur es
of the AT90S4414 as listed on page 51.
RESET
Reset input. A low on th is pi n for two machi ne cy cles wh ile
the oscillator is running resets the device.
XTAL1
Input to the inverting os cillator amplifi er and input to th e
internal clock operating circuit.
XTAL2
Output from the inverting oscillator amplifier
ICP
ICP is the input pin for the Time r/Counter1 Inpu t Capture
function.
)
OC1B
OC1B is the output pin for the Timer/Counter1 Output
CompareB function
ALE
ALE is the Address Latch Enable used when the Ex ternal
Memory is enabled. The ALE strob e is used to latch the
low-order address (8 bits) into an address latch during the
first access cy cle, and the A D0-7 pins a re used for data
during the second access cycle.
Crystal Oscillator
XTAL1 and XTAL2 are input and output, respectively, of an
inverting amplifier which can be configured for use as an
on-chip oscillator, as shown in Figure 2. Either a quartz
crystal or a ceramic resonator may be used. To drive the
device from an external clock source, XTAL2 should be left
unconnected while XTAL1 is driven as shown in Figure 3.
Figure 2.
Figure 3.
Oscillator Connec tio ns
External Clock Drive Configuration
3
Page 4
AT90S4414 Architectural Overview
The fast-access register file concept contains 32 x 8-bit
general purpose worki ng regi ster s with a sin gle cl ock c ycle
access time. This means that during one single clock cycle,
one ALU (Arithmetic Logic Unit) operation is executed. Two
operands are output from the register file, the operation is
executed, and the result is stored back in the register file in one clock cyc le. Six o f the 32 register s can be used as
three 16-bits indirect address register pointers for Data
Space addressing - en abling effici ent addr ess calc ulati ons.
One of the three address pointers is al so used as the
address pointer for the constant table look up function.
These added function reg isters are the 16-bits X-register,
Y-register and Z-register.
Figure 4.
The AT90S4414
AVR
Enhanced RISC Architecture
The ALU supports arithmetic and logic functions between
registers or be tween a const ant and a r egist er. Si ngle re gister operations are also executed in the ALU. Figure 4
AVR
shows the AT90S4 414
ler architecture .
In addition to the register operation, the conventional memory addressing mode s can be used on the re gister file as
well. This is e nabled by th e fact that t he register f ile is
assigned the 32 lowermost Data Space addresses ($00 $1F), allowing them to be accessed as though they were
ordinary memory locations.
The I/O memory space contains 64 addresses for CPU
peripheral functions as Control Registers, Timer/Counters,
4
Enhanced RISC micro control-
AT90S4414
A/D-converters, an d other I/O func tions. The I/O M emory
can be accessed dir ectly, or as the Da ta Space loca tions
following those of the register file, $20 - $5F.
AVR
The
rate memories and buses fo r program and data. The pr ogram memory is executed with a two stage pipeline. While
one instruction is bein g executed, the next ins truction is
pre-fetched from the program memory. This co ncept
enables instructions to be executed in every clock cycle.
The program memory is in-system In-System Programmable Flash memory.
With the relat ive jump an d call i nstructi ons, the w hole 2K
address space i s directl y access ed. Most
uses a Harvard architecture concept - with sepa-
AVR
instructions
Page 5
AT90S4414
have a single 1 6-bit wo rd forma t. Every program memory
address contains a 16- or 32-bit instruction.
During interrupts a nd subr outine cal ls, the re turn addre ss
program counter (PC) is stored on the s tack. The stack is
effectively allocat ed in the g enera l data SRAM, a nd cons equently the stack size is only limited by the total SRAM size
and the usage of the SRA M. Al l us er pro gr ams mu st i nit ia lize the SP in the reset routine (before subroutines or inter-
Figure 5.
Memory Maps
rupts are executed). The 16-bit stack pointer SP is
read/write accessible in the I/O space.
The 256 bytes data SR AM ca n be eas il y ac ce ss ed thr oug h
the five different addressing modes supported in the
architecture.
AVR
The memory spaces in the
and regular memory maps.
architecture are all linear
AVR
A flexible interrupt module has its control registers in the
I/O space with an additional global interrupt enable bit in
the status register. All the different interrupts have a separate interrupt vector in the interrupt vector table at the
beginning of the program memory. The different interrupts
have priority in accordance with their interrupt vector position. The lower the interrupt vector address the higher priority.
$10 ($30)PINDPIND7PIND6PIND5PIND4PIND3PIND2PIND1PIND063
$0F ($2F)SPDR SPI Data Register46
$0E ($2E)SPSRSPIFWCO L
$0D ($2D)SPCRSPIESPEDORDMSTRCPOLCPHASPR1SPR045
$0C ($2C)UDR UART I/O Data Register49
$0B ($2B)USRRXCTXCUDREFEOR
$0A ($2A)UCRRXCIETXCIEUDRIERXENTXENCHR9RXB8TXB850
$09 ($29)UBRR UART Baud Rate Register52
$08 ($28)ACSRACD
…Reserved
$00 ($20)Reserved
-----EEMWEEEWEEERE41
-ACOACIACIEACI CACIS1ACIS053
--CTC1CS12CS11CS1034
------45
-TICIE1-TOIE0-25
-ICF1-TOV0 -26
---49
25
6
AT90S4414
Page 7
AT90S4414
AT90S4414 Instruction Set Summary
MnemonicsOperandsDescriptionOperationFlags#Clocks
ARITHMETIC AND LOGIC INSTRUCTIONS
ADDRd, RrAdd two RegistersRd ← Rd + RrZ,C,N,V,H1
ADCRd, RrAdd with Carry two RegistersRd ← Rd + Rr + CZ,C,N,V,H1
ADIWRdl,KAdd Immediate to WordRdh:Rdl ← Rdh:Rdl + KZ,C,N,V,S2
SUBRd, RrSubtract two RegistersRd ← Rd - RrZ,C,N,V,H1
SUBIRd, KSubtract Constant from Register Rd ← Rd - KZ,C,N,V,H1
SBCRd, RrSubtract with Carry two RegistersRd ← Rd - Rr - CZ,C,N,V,H1
SBCIRd, KSubtract with Carry Constant from Reg.Rd ← Rd - K - CZ,C,N,V,H1
SBIWRdl,KSubtract Immediate from WordRdh:Rdl ← Rdh:Rdl - KZ,C,N,V,S2
ANDRd, RrLogical AND RegistersRd ← Rd • RrZ,N,V1
ANDIRd, KLogical AND Register and ConstantRd ← Rd • KZ,N,V1
ORRd, RrLogical OR RegistersRd ← Rd v RrZ,N,V1
ORIRd, KLogical OR Register and ConstantRd ← Rd v KZ,N,V1
EORRd, RrExclusive OR RegistersRd ← Rd ⊕ RrZ,N,V1
COMRdOne’s ComplementRd ← $FF − RdZ,C,N,V1
NEGRdTwo’s ComplementRd ← $00 − RdZ,C,N,V,H1
SBRRd,KSet Bit(s) in RegisterRd ← Rd v KZ,N,V1
CBRRd,KCle ar Bit(s) in RegisterRd ← Rd • ($FF - K)Z,N,V1
INCRdIncrementRd ← Rd + 1Z,N,V1
DECRdDecrementRd ← Rd − 1 Z,N,V1
TSTRdTest for Zero or MinusRd ← Rd • Rd Z,N,V1
CLRRdClear RegisterRd ← Rd ⊕ RdZ,N,V1
SERRdSet RegisterRd ← $FFNone1
BRANCH INSTRUCTIONS
RJMPkRelative JumpPC ← PC + k + 1None2
IJMPIndirect Jump to (Z)PC ← Z None2
RCALLkRelative Subroutine Call PC ← PC + k + 1None3
ICALLIndirect Call to (Z)PC ← ZNone3
RETSubroutine ReturnPC ← ST A C KNone4
RETIInterrupt ReturnPC ← STACKI4
CPSERd,RrCompare, Skip if Equalif (Rd = Rr) PC ← PC + 2 or 3None1 / 2
CPRd,RrCompareRd − RrZ, N,V,C,H1
CPCRd,RrCompare with CarryRd − Rr − CZ, N,V,C,H1
CPIRd,KCompare Register with ImmediateRd − KZ, N,V,C,H1
SBRCRr, bSkip if Bit in Register Clearedif (Rr(b)=0) PC ← PC + 2 or 3 None1 / 2
SBRSRr, bSkip if Bit in Register is Setif (Rr(b)=1) PC ← PC + 2 or 3None1 / 2
SBICP, bSkip if Bit in I/O Register Clearedif (P(b)=0) PC ← PC + 2 or 3 None1 / 2
SBISP, bSkip if Bit in I/O Register is Setif (P(b)=1) PC ← PC + 2 or 3None1 / 2
BRBSs, kBranch if Status Flag Setif (SREG(s) = 1) then PC←PC+k + 1None1 / 2
BRBCs, kBranch if Status Flag Clearedif (SREG(s) = 0) then PC←PC+k + 1None1 / 2
BREQ kBranch if Equal if (Z = 1) then PC ← PC + k + 1None1 / 2
BRNE kBranch if Not Equalif (Z = 0) then PC ← PC + k + 1None1 / 2
BRCS kBranch if Carry Setif (C = 1) then PC ← PC + k + 1None1 / 2
BRCC kBranch if Carry Clearedif (C = 0) then PC ← PC + k + 1None1 / 2
BRSH kBranch if Same or Higher if (C = 0) then PC ← PC + k + 1None1 / 2
BRLO kBranch if Lowerif (C = 1) then PC ← PC + k + 1None1 / 2
BRMI kBranch if Minusif (N = 1) then PC ← PC + k + 1None1 / 2
BRPL kBranch if Plus if (N = 0) then PC ← PC + k + 1None1 / 2
BRGE kBranch if Greater or Equal, Signedif (N ⊕ V= 0) then PC ← PC + k + 1None1 / 2
BRLT kBranch if Less Than Zero, Signedif (N ⊕ V= 1) then PC ← PC + k + 1None1 / 2
BRHS kBranch if Half Carry Flag Setif (H = 1) then PC ← PC + k + 1None1 / 2
BRHC kBranch if Half Carry Flag Clearedif (H = 0) then PC ← PC + k + 1None1 / 2
BRTS kBranch if T Flag Setif (T = 1) then PC ← PC + k + 1None1 / 2
BRTC kBranch if T Flag Clearedif (T = 0) then PC ← PC + k + 1None1 / 2
BRVS kBranch if Overflow Flag is Setif (V = 1) then PC ← PC + k + 1None1 / 2
BRVC kBranch if Overflow Flag is Clearedif (V = 0) then PC ← PC + k + 1None1 / 2
BRIE kBranch if Interrupt Enabledif ( I = 1) then PC ← PC + k + 1None1 / 2
BRID kBranch if Interrupt Disabledif ( I = 0) then PC ← PC + k + 1None1 / 2
7
Page 8
MnemonicsOperandsDescriptionOperationFlags#Clocks
DATA TRANSFER INSTRUCTIONS
MOVRd, RrMove Between RegistersRd ← RrNone1
LDIRd, KLoad ImmediateRd ← KNone1
LDRd, XLoad IndirectRd ← (X)None2
LDRd, X+Load Indirect and Post-Inc.Rd ← (X), X ← X + 1None2
LDRd, - XLoad Indirect and Pre-Dec.X ← X - 1, Rd ← (X)None2
LDRd, YLoad IndirectRd ← (Y)None2
LDRd, Y+Load Indirect and Post-Inc.Rd ← (Y), Y ← Y + 1None2
LDRd, - YLoad Indirect and Pre-Dec.Y ← Y - 1, Rd ← (Y)None2
LDDRd,Y+qLoad Indirect with DisplacementRd ← (Y + q)None2
LDRd, ZLoad Indirect Rd ← (Z)None2
LDRd, Z+Load Indirect and Post-Inc.Rd ← (Z), Z ← Z+1None2
LDRd, -ZLoad Indirect and Pre-Dec.Z ← Z - 1, Rd ← (Z)None2
LDDRd, Z+qLoad Indirect with DisplacementRd ← (Z + q)None2
LDSRd, kLoad Direct from SRAMRd ← (k)None2
STX, RrStore Indirect(X) ← RrNone2
STX+, RrStore Indirect and Post-Inc.(X) ← Rr, X ← X + 1None2
ST- X, RrStore Indirect and Pre-Dec.X ← X - 1, (X) ← RrNone2
STY, RrStore Indirect(Y) ← RrNone2
STY+, RrStore Indirect and Post-Inc.(Y) ← Rr, Y ← Y + 1None2
ST- Y, RrStore Indirect and Pre-Dec.Y ← Y - 1, (Y) ← RrNone2
STDY+q,RrStore Indirect with Displacement(Y + q) ← RrNone2
STZ, RrStore Indirect(Z) ← RrNone2
STZ+, RrStore Indirect and Post-Inc.(Z) ← Rr, Z ← Z + 1None2
ST-Z, RrStore Indirect and Pre-Dec.Z ← Z - 1, (Z) ← RrNone2
STDZ+q,RrStore Indirect with Displacement(Z + q) ← RrNone2
STSk, RrStore Direct to SRAM(k) ← RrNone2
LPMLoad Program MemoryR0 ← (Z)None3
INRd, PIn PortRd ← PNone1
OUTP, RrOut PortP ← RrNone1
PUSHRrPush Register on StackSTACK ← RrNone2
POPRdPop Register from StackRd ← STAC KNone2
BIT AND BIT-TEST INSTRUCTIONS
SBIP,bSet Bit in I/O RegisterI/O(P,b) ← 1None2
CBIP,bClear Bit in I/O RegisterI/O(P,b) ← 0None2
LSLRdLogical Shift LeftRd(n+1) ← Rd(n), Rd(0) ← 0Z,C,N,V1
LSRRdLogical Shift RightRd(n) ← Rd(n+1), Rd(7) ← 0Z,C,N,V1
ROLRdRotate Left Through CarryRd(0)←C,Rd(n+1)← Rd(n),C←Rd(7)Z,C,N,V1
RORRdRotate Right Through CarryRd(7)←C,Rd(n)← Rd(n+1),C←Rd(0)Z,C,N,V1
ASRRdArithmetic Shift RightRd(n) ← Rd(n+1), n=0..6Z,C,N,V1
SWAPRdSwap NibblesRd(3..0)←Rd(7..4),Rd(7..4)←Rd(3..0)None1
BSETsFlag SetSREG(s) ← 1SREG(s)1
BCLRsFlag ClearSREG(s) ← 0 SREG(s)1
BSTRr, bBit Store from Register to TT ← Rr(b)T1
BLDRd, bBit load from T to RegisterRd(b) ← TNone1
SECSet CarryC ← 1C1
CLCCle ar CarryC ← 0 C1
SENSet Negative FlagN ← 1N1
CLNCle ar Negative FlagN ← 0 N1
SEZSet Zero FlagZ ← 1Z1
CLZClear Zero FlagZ ← 0 Z1
SEIGlobal Interrupt EnableI ← 1I1
CLIGlobal Interrupt DisableI ← 0 I1
SESSet Signed Test FlagS ← 1S1
CLSClear Signed Test FlagS ← 0 S1
SEVSet Twos Complement Overflow.V ← 1V1
CLVClear Twos Complement OverflowV ← 0 V1
SETSet T in SREGT ← 1T1
CLTClear T in SREGT ← 0 T1
SEHSet Half Carry Flag in SREGH ← 1H1
CLHClear Half Carry Flag in SREGH ← 0 H1
NOPNo OperationNone1
SLEEPSleep(see specific descr. for Sleep function)None3
WDRWatchdog Reset(see specific descr. for WDR/timer)None1
8
AT90S4414
Page 9
AT90S4414
Ordering Information
Speed (MHz)Power SupplyOrdering Code*PackageOperation Range