* Max speed depends on Vcc voltage. Frequencies and Currents listed are for
Vcc = 5.0V & T = 25ºC
Please verify correct part codes for low voltage parts before ordering.
Key
SRAM- Static RAM
ISP- In-System Programmable
I/O- Input/Output
ADC- Analogue to Digital Convertor
SPI- Serial Peripheral Interface
PWM- Pulse Width Modulation
PAR - Parallel programming mode
FLASH- Reprogrammable Code Memory
EEPROM - Parallel programming mode
Atmel AVR Microcontroller Family - Product Selection Guide
For further information please contact Equinox Technologies UK Ltd on Tel: +44 (0) 1204 529000 Fax: +44 (0) 1204 535555 E-mail: sales@equinox-tech.com
Disclaimer: Whilst information is supplied in good faith, we are not liable for any errors or omissions. Please consult the relevant Atmel datasheet. E&OE
I/O Pins151553232203232I/O, 8O, 8I32I/O, 8O, 8I
On-chip RC OscillatorYESNOYESNONONONONONO
Real Time Clock (RTC)NONONONONONONOYESYES
SPI PortNONONOYESYESYESYESYESYES
Full Duplex Serial UARTNOYESNOYESYESYESYES11
Watchdog TimerYESYESYESYESYESYESYESYESYES
Timer/Counters122222 233
PWM Channels (10-bit)-1-221TBA22
Analogue ComparatorYESYESNONONONONONONO
ADCNONONONONO6CH/10BIT8CH/10BIT8CH/10BIT8CH/10BIT
IDLE and Power Down modesYESYESYESYESYESYESYESYESYES
Interrupts 4113131314172424
MISCELLANEOUS
AVR Instructions89118118118118118120121121
Max External Clock Frequency12MHz10MHz10MHz8MHz8MHz8MHz8MHz6MHz6MHz
Vcc Voltage Range (V)4.0-6.0V4.0-6.0V4.0-6.0V4.0-6.0V4.0-6.0V4.0-6.0V4.0-6.0V4.0-6.0V4.0-6.0V
EQUINOX SUPPORT TOOLS
AVR Starter SystemISP/PARISP/PARISP/PARISP/PARISP/PARISP/PARISP onlyACT-UPG1ACT-UPG1
AVR Development SystemZIF-ISPZIF-ISPZIF-ISPZIF-ISPZIF-ISPZIF-ISPZIF-ISPUISP-UPG1UISP-UPG1
Micro-ISP Series IV ProgrammerISP onlyISP onlyISP onlyISP onlyISP onlyISP onlyISP onlyISP onlyISP only
Micro-ISP Series IV LV Prog.ISP onlyISP onlyISP onlyISP onlyISP onlyISP onlyISP onlyISP onlyISP only
Micro-Pro Device ProgrammerPAR onlyPAR only-ZIF-ISPZIF-ISP----
AllWriter Universal ProgrammerPARPAR-PARPAR----
AVR BASIC LITEYES (1K)--------
AVR BASIC FULLYESYESYESYESYESYESYESYESYES
AT90S8515 Socket Stealer (DIL-40)NONONOYESYESNONONONO
Atmel AVR Microcontroller Family - Product Selection Guide
For further information please contact Equinox Technologies UK Ltd on Tel: +44 (0) 1204 529000 Fax: +44 (0) 1204 535555 E-mail: sales@equinox-tech.com
Disclaimer: Whilst information is supplied in good faith, we are not liable for any errors or omissions. Please consult the relevant Atmel datasheet. E&OE
On some devices, the lock bits will not erase at hig h VCC. In this situation, it will
not be possible to reprogram the devices when the lock bits are set.
Problem Fix/Workaround
Lower V
unlock, and it will be possible to reprogram the device at any V
3. Reset During EEPROM Write
If reset is activated during EEPROM write the result is not what should be
expected. The EEPR OM write cyc le comple tes as norm al, but the ad dress reg isters are reset to 0. The result is that both the address written and address 0 in the
EEPROM can be corrupted.
Problem Fix/Workaround
Avoid using address 0 for storage , unles s you can guaran tee that you wi ll not ge t
a reset during EEPROM write.
2. Verifying EEPROM in System
EEPROM veri fy in I n-Sys tem P rogram ming mo de ca nnot op erat e with m aximu m
clock frequency. This is independent of the SPI clock frequency.
Problem Fix/Workaround
Reduce the clock speed, or avoid using the EEPROM verify feature.
1. Serial Programming at Voltages Below 3.0 Volts
At voltages below 3.0 Volts, serial programming might fail.
Problem Fix/Workaround
Keep V
below 4.0V before you perform a chip-erase. Then the device will
CC
above 3.0 Volts during in-system programming.
CC
CC
CC
.
8-Bit
Microcontroller
with 2K bytes
In-System
Programmable
Flash
AT90S2313
Rev. B
Errata Sheet
Rev. 1191B–01/99
1
Atmel HeadquartersAtmel Operations
Corporate Headquarters
2325 Orchard Parkway
San Jose, CA 95131
TEL (408) 441- 0311
FAX (408) 487-2600
Europe
Atmel U.K., Ltd.
Coliseum Business Centre
Riverside Way
Camberley, Surrey GU15 3YL
England
TEL (44) 1276-686677
FAX (44) 1276-686697
Asia
Atmel Asia, Ltd.
Room 1219
Chinachem Golden Plaza
77 Mody Road
Tsimshatsui East
Kowloon, Hong Kong
TEL (852) 27219778
FAX (852) 27221369
Japan
Atmel Japan K.K.
Tonetsu Shinkawa Bldg., 9F
1-24-8 Shinka wa
Chuo-ku, Tokyo 104-0033
Japan
TEL (81) 3-3523-3551
FAX (81) 3-3523-7581
Atmel Colorado Springs
1150 E. Cheyenne Mtn. Blvd.
Colorado Springs, CO 80906
TEL (719) 576-3300
FAX (719) 540-1759
Atmel Rousset
Zone Indu strie lle
13106 Rousset Cedex, France
TEL (33) 4 42 53 60 00
FAX (33) 4 42 53 60 01
Atmel Corporation makes no warranty for the use of its products, other than those expressly contained in the Company’s standard warranty which is detailed in Atmel’s Terms and Conditions located on the Company’s web site. The Company assumes no responsibility for
any errors which may appear in this document, reserves the right to change devices or specifications detailed herein at any time without
notice, and does not make any commitment to update the information contained herein. No licenses to patents or other intellectual property of Atmel are granted by the Company in connection with the sale of Atmel products, expressly or by implication. Atmel’s products are
not authorized for use as critical components in life support devices or systems.
Marks bearing ® and/or ™ are registered trademarks and trademarks of Atmel Corporation.
Terms and product names in this document may be trademarks of others.
Printed on recycled paper.
1191B–01/99/xM
Features
•
Utilizes the AVR® RISC Architecture
•
AVR - High-performance and Low-power RISC Architecture
– 118 Powerful Instructions - Most Single Clock Cycle Execution
– 32 x 8 General Purpose Working Registers
– Up to 10 MIPS Throughput at 10 MHz
•
Data and Nonvolatile Program Memory
– 2K Bytes of In-System Programmable Flash
Endurance 1,000 Write/Erase Cycles
– 128 Bytes of SRAM
– 128 Bytes of In-System Programmable EEPROM
Endurance: 100,000 Write/Erase Cycles
– Programming Lock for Flash Program and EEPROM Data Security
•
Peripheral Features
– One 8-bit Timer/Counter with Separate Prescaler
– One 16-bit Timer/Counter with Separate Prescaler,
Compare, Capture Modes and 8-, 9- or 10-bit PWM
– On-chip Analog Comparator
– Programmable Watchdog Timer with On-chip Oscillator
– SPI Serial Interface for In-System Programming
– Full Duplex UART
•
• Special Microcontroller Features
– Low-power Idle and Power Down Modes
– External and Internal Interrupt Sources
8-bit
Microcontroller
with 2K bytes
In-System
Programmable
Flash
AT90S2313
Description
The AT90S2313 is a low-power CMOS 8-bit microcontroller based on the AVR RISC
architecture. By executing powerful instructions in a single clock cycle, the
(continued)
Pin Configuration
PDIP/SOIC
Note: This is a summary document. For the complete 87 page
document, please visit our web site at
literature@atmel.com
Rev. 0839ES–04/99
www.atmel.com
and request literature #0839E.
or e-mail at
1
AT90S2313 achieves throughputs approaching 1 MIPS per MHz allowing the system designer to optimize power consumption versus processing speed.
The AVR core combines a rich instruction set with 32 general purpose working registers. All the 32 registers are directly
connected to the Arithmetic Logic Unit (ALU), allowing 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.
Block Diagram
Figure 1.
The AT90S2313 Block Diagram
2
AT90S2313
AT90S2313
The AT90S2313 provides the following features: 2K bytes of In-System Programmable Flash, 128 bytes EEPROM,
128 bytes SRAM, 15 general purpose I/O lines, 32 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 for Flash Memory d ownloading and two software selec table power sav ing modes. The Idle Mode
stops the CPU while allowi ng the SRAM, timer/ counte rs, SPI po rt and i nterrup t syst em to contin ue func tionin g. The power
down mode saves the register contents but freezes the oscillator, disabling all other chip functions until the next external
interrupt or hardware reset.
The device is manufactured using Atmel’s high density nonvolatile memory technology. The on-chip In-System Programmable Flash allows the program memory to be reprogrammed in-system through an SPI serial interface or by a
conventional non vo lat il e m emo ry p ro gramm er . B y co mbi ni ng an e nha nc ed RISC 8-bit CPU with In-System Programm abl e
Flash on a monolithic chip, the Atmel AT90S2313 is a powerful microcontroller that provides a highly flexible and cost
effective solution to many embedded control applications.
The AT90S2313 AVR is supported with a full suite of program and system development tools including: C compilers, macro
assemblers, program debugger/simulators, in-circuit emulators, and evaluation kits.
Pin Descriptions
VCC
Supply voltage pin.
GND
Ground pin.
Port B (PB7..PB0)
Port B is an 8-bit bi-directional I/O port. Port pins can provide internal pull-up resistors (selected for each bit). PB0 and PB1
also serve as th e pos itiv e in put (AI N0) a nd th e nega tive inpu t (AIN1 ), res pecti vely, of th e on-c hip a nalog com parator . The
Port B output buffers can sink 20mA and can drive LED displays directly. When pins PB0 to PB7 are used as inputs and
are externally pulled low, they will source current if the internal pull-up resistors are activated. The Port B pins are tri-stated
when a reset condition becomes active, even if the clock is not active.
Port D (PD6..PD0)
Port D has seven bi-directional I/O port with internal pull-up resistors, PD6..PD0. The Port D output buffers can sink 20 mA.
As inputs, Port D pins that are externally pulled low will source current if the pull-up resistors are activated. The Port D pins
are tri-stated when a reset condition becomes active, even if the clock is not active.
RESET
Reset input. A low level on this pin for more than 50 ns will generate a reset, even if the clock is not running. Shorter pulses
are not guaranteed to generate a reset.
XTAL1
Input to the inverting oscillator amplifier and input to the internal clock operating circuit.
XTAL2
Output from the inverting oscillator amplifier
3
Architectural Overview
The fast-access register file concept contains 32 x 8-bit general purpose working registers with a single clock cycle access
time. This means th at d ur ing one single clock cycle, one ALU (Ar ithmeti c Logic Unit) operation is executed. Two ope ra nds
are output from the register file, the operation is executed, and the result is stored back in the register file - in one clock
cycle.
Figure 2.
The AT90S2313 AVR RISC Architecture
Six of the 32 registers can be used as three 16-bits indirect address register pointers for Data Space addressing - enabling
efficient address cal culation s. O ne of the three address point ers is also used a s the ad dress pointer for the c onst ant tabl e
look up function. These added function registers are the 16-bits X-register, Y-register and Z-register.
The ALU supports arithmetic and logic functions between registers or between a constant and a register. Single register
operations are also executed in the ALU. Figure 2 shows the AT90S2313 AVR RISC microcontroller architecture.
In addition to the register operation, the conventional memory addressing modes can be used on the register file as well.
This is enabled by the fa ct th at the regis ter file is as signe d the 32 lowerm ost Data S pace a ddre sses ($00 - $1F) , al lowin g
them to be accessed as though they were ordinary memory locations.
4
AT90S2313
AT90S2313
The I/O memory space contains 64 addresses for CPU peripheral functions as Control Registers, Timer/Counters,
A/D-converters, and oth er I/O func tions. The I/O mem ory can be accessed di rectl y, or as the D ata Space lo catio ns foll owing those of the register file, $20 - $5F.
The AVR has Harvard architecture - with separate memories and buses for pro gram and data. The progr am memory is
accessed with a two stage pipeline. While one instruc tion is being executed, the next instruction i s pre-fetched from the
program memory. This concept enables instructions to be executed in every clock cycle. The program memory is In-system
Programmable Flash memory.
With the relative jump and call instructions, the whole 1K address space is directly accessed. Most AVR instructions have a
single 16-bit word format. Every program memory address contains a 16- or 32-bit instruction.
During interrupts and subroutine c alls, the ret urn address program counter (PC) is stor ed on the stac k. The stac k is
effectively allocated in the general data SRAM, and co ns equ entl y the sta ck s iz e i s onl y li mi ted b y the total SRAM size and
the usage of the SRAM. All user programs must initialize the SP in the reset routine (before subroutines or interrupts are
executed). The 8-bit stack pointer SP is read/write accessible in the I/O space.
The 128 bytes data SRAM + r egister file and I/O registe rs can be easil y accessed through the fi ve different addr essing
modes supported in the AVR architecture.
The memory spaces in the AVR architecture are all linear and regular memory maps.
Figure 3.
Memory Mapss
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 interrup ts have a sepa rate inter rupt vecto r in the interrupt ve ctor tab le at the beginn ing of the program memory. The different int errupts have pr iority in acco rdance with thei r interrupt vec tor position . The lower the
interrupt vector address the higher the priority.
Notes: 1. For compatibility with future devices, reserved bits should be written to zero if accessed. Reserved I/O memory addresses
should never be written.
2. Some of the status flags are cleared by writing a logical one to them. Note that the CBI and SBI instructions will operate on
all bits in the I/O register, writing a one back into any flag read as set, thus clearing the flag. The CBI and SBI instructions
work with registers $00 to $1F only.
26
6
AT90S2313
AT90S2313
Instruction Set Summary
MnemonicsOperandsDescriptionOperationFlags#Clocks
ARITHMETIC AND LOGIC INSTRUCTIONS
ADDRd, RrAdd two Registers
ADCRd, RrAdd with Carry two Registers
ADIWRdl,KAdd Immediate to Word
SUBRd, RrSubtract two Registers
SUBIRd, KSubtract Constant from Register
SBIWRdl,KSubtract Immediate from Word
SBCRd, RrSubtract with Carry two Registers
SBCIRd, KSubtract with Carry Constant from Reg.
ANDRd, RrLogical AND Registers
ANDIRd, KLogical AND Register and Constant
ORRd, RrLogical OR Registers
ORIRd, KLogical OR Register and Constant
EORRd, RrExclusive OR Registers
COMRdOne’s Complement
NEGRdTwo’s Complement
SBRRd,KSet Bit(s) in Register
CBRRd,KClear Bit(s) in Register
INCRdIncrement
DECRdDecrement
TSTRdTest for Zero or Minus
CLRRdClear Register
SERRdSet Register
BRANCH INSTRUCTIONS
RJMPkRelative Jump
IJMPIndirect Jump to (Z)
RCALLkRelative Subroutine Call
ICALLIndirect Call to (Z)
RETSubroutine Return
RETIInterrupt Return
CPSERd,RrCompare, Skip if Equal
CPRd,RrCompareRd
CPCRd,RrCompare with CarryRd
CPIRd,KCompare Register with ImmediateRd
SBRCRr, bSkip if Bit in Register Cleared
SBRSRr, bSkip if Bit in Register is Set
SBICP, bSkip if Bit in I/O Register Cleared
SBISP, bSkip if Bit in I/O Register is Set
BRBSs, kBranch if Status Flag Set
BRBCs, kBranch if Status Flag Cleared
BREQ kBranch if Equal
BRNE kBranch if Not Equal
BRCS kBranch if Carry Set
BRCC kBranch if Carry Cleared
BRSH kBranch if Same or Higher
BRLO kBranch if Lower
BRMI kBranch if Minus
BRPL kBranch if Plus
BRGE kBranch if Greater or Equal, Signed
BRLT kBranch if Less Than Zero, Signed
BRHS kBranch if Half Carry Flag Set
BRHC kBranch if Half Carry Flag Cleared
BRTS kBranch if T Flag Set
BRTC kBranch if T Flag Cleared
BRVS kBranch if Overflow Flag is Set
BRVC kBranch if Overflow Flag is Cleared
BRIE kBranch if Interrupt Enabled
BRID kBranch if Interrupt Disabled
Rd ← Rd + Rr
Rd ← Rd + Rr + C
Rdh:Rdl ← Rdh:Rdl + K
Rd ← Rd − Rr
Rd ← Rd − K
Rdh:Rdl ← Rdh:Rdl − K
Rd ← Rd − Rr − C
Rd ← Rd − K − C
Rd ← Rd • Rr
Rd ← Rd • K
Rd ← Rd v Rr
Rd ← Rd v K
Rd ← Rd ⊕ Rr
Rd ← $FF − Rd
Rd ← $00 − Rd
Rd ← Rd v K
Rd ← Rd • ($FF − K)
Rd ← Rd + 1
Rd ← Rd − 1
Rd ← Rd • Rd
Rd ← Rd ⊕ Rd
Rd ← $FF
PC ← PC + k + 1
PC ← Z
PC ← PC + k + 1
PC ← Z
PC ← STACK
PC ← STACK
if (Rd = Rr) PC ← PC + 2 or 3
− RrZ, N,V,C,H1
− Rr − CZ, N,V,C,H1
− KZ, N,V,C,H1
if (Rr(b)=0) PC ← PC + 2 or 3
if (Rr(b)=1) PC ← PC + 2 or 3
if (P(b)=0) PC ← PC + 2 or 3
if (R(b)=1) PC ← PC + 2 or 3
if (SREG(s) = 1) then PC←PC + k + 1
if (SREG(s) = 0) then PC←PC + k + 1
if (Z = 1) then PC ← PC + k + 1
if (Z = 0) then PC ← PC + k + 1
if (C = 1) then PC ← PC + k + 1
if (C = 0) then PC ← PC + k + 1
if (C = 0) then PC ← PC + k + 1
if (C = 1) then PC ← PC + k + 1
if (N = 1) then PC ← PC + k + 1
if (N = 0) then PC ← PC + k + 1
if (N ⊕ V= 0) then PC ← PC + k + 1
if (N ⊕ V= 1) then PC ← PC + k + 1
if (H = 1) then PC ← PC + k + 1
if (H = 0) then PC ← PC + k + 1
if (T = 1) then PC ← PC + k + 1
if (T = 0) then PC ← PC + k + 1
if (V = 1) then PC ← PC + k + 1
if (V = 0) then PC ← PC + k + 1
if (I = 1) then PC ← PC + k + 1
if (I = 0) then PC ← PC + k + 1
MOVRd, RrMove Between RegistersRd
LDIRd, KLoad ImmediateRd
LDRd, XLoad IndirectRd
LDRd, X+Load Indirect and Post-Inc.Rd
LDRd, - XLoad Indirect and Pre-Dec.X
LDRd, YLoad IndirectRd
LDRd, Y+Load Indirect and Post-Inc.Rd
LDRd, - YLoad Indirect and Pre-Dec.Y
LDDRd,Y+qLoad Indirect with DisplacementRd
LDRd, ZLoad Indirect Rd
LDRd, Z+Load Indirect and Post-Inc.Rd
LDRd, -ZLoad Indirect and Pre-Dec.Z
LDDRd, Z+qLoad Indirect with DisplacementRd
LDSRd, kLoad Direct from SRAMRd
STX, RrStore Indirect(X)
STX+, RrStore Indirect and Post-Inc.(X)
ST- X, RrStore Indirect and Pre-Dec.X
STY, RrStore Indirect(Y)
STY+, RrStore Indirect and Post-Inc.(Y)
ST- Y, RrStore Indirect and Pre-Dec.Y
STDY+q,RrStore Indirect with Displacement(Y + q)
STZ, RrStore Indirect(Z)
STZ+, RrStore Indirect and Post-Inc.(Z)
ST-Z, RrStore Indirect and Pre-Dec.Z
STDZ+q,RrStore Indirect with Displacement(Z + q)
STSk, RrStore Direct to SRAM(k)
LPMLoad Program MemoryR 0
INRd, PIn PortRd
OUTP, RrOut PortP
PUSHRrPush Register on StackSTACK
POPRdPop Register from StackRd
BIT AND BIT-TEST INSTRUCTIONS
SBIP,bSet Bit in I/O RegisterI/O(P,b)
CBIP,bClear Bit in I/O RegisterI/O(P,b)
LSLRdLogical Shift LeftRd(n+1)
LSRRdLogical Shift RightRd(n)
ROLRdRotate Left Through CarryRd(0)
RORRdRotate Right Through CarryRd(7)
ASRRdArithmetic Shift RightRd(n)
SWAPRdSwap NibblesRd(3..0)
BSETsFlag SetSREG(s)
BCLRsFlag ClearSREG(s)
BSTRr, bBit Store from Register to TT
BLDRd, bBit load from T to RegisterRd(b)
SECSet CarryC
CLCClear CarryC
SENSet Negative FlagN
CLNClear Negative FlagN
SEZSet Zero FlagZ
CLZClear Zero FlagZ
SEIGlobal Interrupt EnableI
CLIGlobal Interrupt DisableI
SESSet Signed Test FlagS
CLSClear Signed Test FlagS
SEVSet Twos Complement OverflowV
CLVClear Twos Complement OverflowV
SETSet T in SREGT
CLTClear T in SREGT
SEHSet Half Carry Flag in SREGH
CLHClear Half Carry Flag in SREGH
NOPNo OperationNone1
SLEEPSleep(see specific descr. for Sleep function)None3
WDRWatchdog Reset(see specific descr. for WDR/timer)None1
Atmel Corporation makes no warranty for the use of its products, other than those expressly contained in the Company’s standard warranty which is detailed in Atmel’s Terms and Conditions located on the Company’s web site. The Company assumes no responsibility for
any errors which may appear in this document, reserves the right to change devices or specifications detailed herein at any time without
notice, and does not make any commitment to update the information contained herein. No licenses to patents or other intellectual property of Atmel are granted by the Company in connection with the sale of Atmel products, expressly or by implication. Atmel’s products are
not authorized for use as critical components in life support devices or systems.
Marks bearing ® and/or ™ are registered trademarks and trademarks of Atmel Corporation.
Terms and product names in this document may be trademarks of others.
Printed on recycled paper.
0839ES–04/99/xM
Loading...
+ 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.