This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
2543DS–AVR–03/04
8-bit Microcontroller with 2K Bytes In-SystemProgrammable Flash
ATtiny2313/V
PreliminarySummary
Rev. 2543DS–AVR–03/04
Features• Utilizes the AVR® RISC Architecture• AVR – High-performance and Low-power RISC Architecture
– 120 Powerful Instructions – Most Single Clock Cycle Execution– 32 x 8 General Purpose Working Registers– Fully Static Operation– Up to 24 MIPS Throughput at 24 MHz
• Data and Non-volatile Program and Data Memories– 2K Bytes of In-System Self Programmable Flash
Endurance: 100,000 Write/Erase Cycles– 128 Bytes Internal SRAM– Programming Lock for Flash Program and EEPROM Data Security
• Peripheral Features– One 8-bit Timer/Counter with Separate Prescaler and Compare Mode– One 16-bit Timer/Counter with Separate Prescaler, Compare and Capture Modes– Four PWM Channels– On-chip Analog Comparator– Programmable Watchdog Timer with On-chip Oscillator– USI – Universal Serial Interface– Full Duplex USART
• Special Microcontroller Features– debugWIRE On-chip Debugging– In-System Programmable via SPI Port– External and Internal Interrupt Sources– Low-power Idle, Power-down, and Standby Modes– Enhanced Power-on Reset Circuit– Programmable Brown-out Detection Circuit– Internal Calibrated Oscillator
• I/O and Packages– 18 Programmable I/O Lines– 20-pin PDIP, 20-pin SOIC, and 32-pin MLF
Note: This is a summary document. A complete documentis available on our Web site at www.atmel.com.
Pin Configurations Figure 1. Pinout ATtiny2313
Overview The ATtiny2313 is a low-power CMOS 8-bit microcontroller based on the AVRenhanced RISC architecture. By executing powerful instructions in a single clock cycle,the ATtiny2313 achieves throughputs approaching 1 MIPS per MHz allowing the systemdesigner 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), allowingtwo independent registers to be accessed in one single instruction executed in one clockcycle. The resulting architecture is more code efficient while achieving throughputs up toten times faster than conventional CISC microcontrollers.
The ATtiny2313 provides the following features: 2K bytes of In-System ProgrammableFlash, 128 bytes EEPROM, 128 bytes SRAM, 18 general purpose I/O lines, 32 generalpurpose working registers, a single-wire Interface for On-chip Debugging, two flexibleTimer/Counters with compare modes, internal and external interrupts, a serial program-mable USART, Universal Serial Interface with Start Condition Detector, a programmableWatchdog Timer with internal Oscillator, and three software selectable power savingmodes. The Idle mode stops the CPU while allowing the SRAM, Timer/Counters, andinterrupt system to continue functioning. The Power-down mode saves the register con-tents but freezes the Oscillator, disabling all other chip functions until the next interruptor hardware reset. In Standby mode, the crystal/resonator Oscillator is running while therest of the device is sleeping. This allows very fast start-up combined with low-powerconsumption.
The device is manufactured using Atmel’s high density non-volatile memory technology.The On-chip ISP Flash allows the program memory to be reprogrammed In-Systemthrough an SPI serial interface, or by a conventional non-volatile memory programmer.By combining an 8-bit RISC CPU with In-System Self-Programmable Flash on a mono-lithic chip, the Atmel ATtiny2313 is a powerful microcontroller that provides a highlyflexible and cost effective solution to many embedded control applications.
The ATtiny2313 AVR is supported with a full suite of program and system developmenttools including: C Compilers, Macro Assemblers, Program Debugger/Simulators, In-Cir-cuit Emulators, and Evaluation kits.
4 ATtiny2313/V2543DS–AVR–03/04
ATtiny2313/V
Pin Descriptions
VCC Digital supply voltage.
GND Ground.
Port A (PA2..PA0) Port A is a 3-bit bi-directional I/O port with internal pull-up resistors (selected for eachbit). The Port A output buffers have symmetrical drive characteristics with both high sinkand source capability. As inputs, Port A pins that are externally pulled low will sourcecurrent if the pull-up resistors are activated. The Port A pins are tri-stated when a resetcondition becomes active, even if the clock is not running.
Port A also serves the functions of various special features of the ATtiny2313 as listedon page 52.
Port B (PB7..PB0) Port B is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for eachbit). The Port B output buffers have symmetrical drive characteristics with both high sinkand source capability. As inputs, Port B pins that are externally pulled low will sourcecurrent if the pull-up resistors are activated. The Port B pins are tri-stated when a resetcondition becomes active, even if the clock is not running.
Port B also serves the functions of various special features of the ATtiny2313 as listedon page 52.
Port D (PD6..PD0) Port D is a 7-bit bi-directional I/O port with internal pull-up resistors (selected for eachbit). The Port D output buffers have symmetrical drive characteristics with both high sinkand source capability. As inputs, Port D pins that are externally pulled low will sourcecurrent if the pull-up resistors are activated. The Port D pins are tri-stated when a resetcondition becomes active, even if the clock is not running.
Port D also serves the functions of various special features of the ATtiny2313 as listedon page 55.
RESET Reset input. A low level on this pin for longer than the minimum pulse length will gener-ate a reset, even if the clock is not running. The minimum pulse length is given in Table15 on page 33. Shorter pulses are not guaranteed to generate a reset. The Reset Inputis an alternate function for PA2 and dW.
XTAL1 Input to the inverting Oscillator amplifier and input to the internal clock operating circuit.XTAL1 is an alternate function for PA0.
XTAL2 Output from the inverting Oscillator amplifier. XTAL2 is an alternate function for PA1.
Figure 3.
52543DS–AVR–03/04
Register SummaryAddress Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Page
Note: 1. For compatibility with future devices, reserved bits should be written to zero if accessed. Reserved I/O memory addressesshould never be written.
2. I/O Registers within the address range 0x00 - 0x1F are directly bit-accessible using the SBI and CBI instructions. In theseregisters, the value of single bits can be checked by using the SBIS and SBIC instructions.
3. Some of the status flags are cleared by writing a logical one to them. Note that, unlike most other AVRs, the CBI and SBIinstructions will only operate on the specified bit, and can therefore be used on registers containing such status flags. TheCBI and SBI instructions work with registers 0x00 to 0x1F only.
4. When using the I/O specific commands IN and OUT, the I/O addresses 0x00 - 0x3F must be used. When addressing I/ORegisters as data space using LD and ST instructions, 0x20 must be added to these addresses.
72543DS–AVR–03/04
Instruction Set SummaryMnemonics Operands Description Operation Flags #Clocks
Note: 1. This device can also be supplied in wafer form. Please contact your local Atmel sales office for detailed ordering informationand minimum quantities.
2. Pb-free packaging alternative.3. See Figure 81 on page 177 and Figure 82 on page 177.
Speed (MHz) Power Supply Ordering Code Package(1) Operation Range
Notes: 1. This drawing is for general information only; refer to JEDEC Drawing MS-013, Variation AC for additional information.2. Dimension "D" does not include mold Flash, protrusions or gate burrs. Mold Flash, protrusions and gate burrs shall not exceed
0.15 mm (0.006") per side.3. Dimension "E" does not include inter-lead Flash or protrusion. Inter-lead Flash and protrusions shall not exceed 0.25 mm
(0.010") per side.4. "L" is the length of the terminal for soldering to a substrate.5. The lead width "b", as measured 0.36 mm (0.014") or greater above the seating plane, shall not exceed a maximum value of 0.61 mm
(0.024") per side.
A 0.0926 0.1043
A1 0.0040 0.0118
b 0.0130 0.0200 4
C 0.0091 0.0125
D 0.4961 0.5118 1
E 0.2914 0.2992 2
H 0.3940 0.4190
L 0.0160 0.050 3
e 0.050 BSC
12 ATtiny2313/V2543DS–AVR–03/04
ATtiny2313/V
Errata The revision in this section refers to the revision of the ATtiny2313 device.
ATtiny2313 Rev B • Wrong values read after Erase Only operation• Parallel Programming does not work• Watchdog Timer Interrupt disabled
1. Wrong values read after Erase Only operation
At supply voltages below 2.7 V, an EEPROM location that is erased by the EraseOnly operation may read as programmed (0x00).
Problem Fix/Workaround
If it is necessary to read an EEPROM location after Erase Only, use an Atomic Writeoperation with 0xFF as data in order to erase a location. In any case, the Write Onlyoperation can be used as intended. Thus no special considerations are needed aslong as the erased location is not read before it is programmed.
2. Parallel Programming does not work
Parallel Programming is not functioning correctly. Because of this, reprogrammingof the device is impossible if one of the following modes are selected:
Serial Programming is still working correctly. By avoiding the two modes above, thedevice can be reprogrammed serially.
3. Watchdog Timer Interrupt disabled
If the watchdog timer interrupt flag is not cleared before a new timeout occurs, thewatchdog will be disabled, and the interrupt flag will automatically be cleared. This isonly applicable in interrupt only mode. If the Watchdog is configured to reset thedevice in the watchdog time-out following an interrupt, the device works correctly.
Problem fix / Workaround
Make sure there is enough time to always service the first timeout event before anew watchdog timeout occurs. This is done by selecting a long enough time-outperiod.
ATtiny2313 Rev A Revision A has not been sampled.
132543DS–AVR–03/04
Datasheet Change Log for ATtiny2313
Please note that the referring page numbers in this section are referred to this docu-ment. The referring revision in this section are referring to the document revision.
Changes from Rev. 2514C-12/03 to Rev. 2514D-03/04
Changes from Rev. 2514B-09/03 to Rev. 2514C-12/03
Changes from Rev. 2514A-09/03 to Rev. 2514B-09/03
1. Updated Table 2 on page 22.2. Replaced “Watchdog Timer” on page 38.3. Added “Maximum Speed vs. VCC” on page 176.4. “Serial Programming Algorithm” on page 171 updated.5. Changed mA to µA in preliminary Figure 110 on page 192.6. “Ordering Information” on page 10 updated.
MLF package option removed7. Package drawing “20P3” on page 11 updated.8. Updated C-code examples.9. Renamed instances of SPMEN to SELFPRGEN, Self Programming
Enable.
1. Updated “Calibrated Internal RC Oscillator” on page 24.
1. Fixed typo from UART to USART and updated Speed Grades and PowerConsumption Estimates in “Features” on page 1.
2. Updated “Pin Configurations” on page 2.3. Updated Table 15 on page 33 and Table 80 on page 176.4. Updated item 5 in “Serial Programming Algorithm” on page 171.5. Updated “Electrical Characteristics” on page 175.6. Updated Figure 81 on page 177 and added Figure 82 on page 177.7. Changed SFIOR to GTCCR in “Register Summary” on page 6.8. Updated “Ordering Information” on page 10.9. Added new errata in “Errata” on page 13.
14 ATtiny2313/V2543DS–AVR–03/04
Disclaimer: Atmel Corporation makes no warranty for the use of its products, other than those expressly contained in the Company’s standardwarranty which is detailed in Atmel’s Terms and Conditions located on the Company’s web site. The Company assumes no responsibility for anyerrors which may appear in this document, reserves the right to change devices or specifications detailed herein at any time without notice, anddoes not make any commitment to update the information contained herein. No licenses to patents or other intellectual property of Atmel aregranted by the Company in connection with the sale of Atmel products, expressly or by implication. Atmel’s products are not authorized for useas critical components in life support devices or systems.