- •Features
- •Pin Configurations
- •Overview
- •Block Diagram
- •Pin Descriptions
- •Port A (PA2..PA0)
- •Port B (PB7..PB0)
- •Port D (PD6..PD0)
- •RESET
- •XTAL1
- •XTAL2
- •Disclaimer
- •AVR CPU Core
- •Introduction
- •Architectural Overview
- •Status Register
- •Stack Pointer
- •Interrupt Response Time
- •SRAM Data Memory
- •Data Memory Access Times
- •EEPROM Data Memory
- •EEPROM Read/Write Access
- •Atomic Byte Programming
- •Split Byte Programming
- •Erase
- •Write
- •I/O Memory
- •General Purpose I/O Registers
- •Clock Systems and their Distribution
- •Clock Sources
- •Default Clock Source
- •Crystal Oscillator
- •External Clock
- •Idle Mode
- •Power-down Mode
- •Standby Mode
- •Analog Comparator
- •Brown-out Detector
- •Internal Voltage Reference
- •Watchdog Timer
- •Port Pins
- •Resetting the AVR
- •Reset Sources
- •Power-on Reset
- •External Reset
- •Brown-out Detection
- •Watchdog Reset
- •Watchdog Timer
- •Interrupts
- •I/O-Ports
- •Introduction
- •Configuring the Pin
- •Toggling the Pin
- •Reading the Pin Value
- •Alternate Port Functions
- •Alternate Functions of Port A
- •Alternate Functions of Port B
- •Alternate Functions of Port D
- •Register Description for I/O-Ports
- •External Interrupts
- •8-bit Timer/Counter0 with PWM
- •Overview
- •Registers
- •Definitions
- •Counter Unit
- •Output Compare Unit
- •Force Output Compare
- •Modes of Operation
- •Normal Mode
- •Fast PWM Mode
- •Phase Correct PWM Mode
- •Internal Clock Source
- •Prescaler Reset
- •External Clock Source
- •16-bit Timer/Counter1
- •Overview
- •Registers
- •Definitions
- •Compatibility
- •Counter Unit
- •Input Capture Unit
- •Input Capture Trigger Source
- •Noise Canceler
- •Using the Input Capture Unit
- •Output Compare Units
- •Force Output Compare
- •Modes of Operation
- •Normal Mode
- •Fast PWM Mode
- •Phase Correct PWM Mode
- •USART
- •Overview
- •Clock Generation
- •External Clock
- •Synchronous Clock Operation
- •Frame Formats
- •Parity Bit Calculation
- •USART Initialization
- •Sending Frames with 5 to 8 Data Bit
- •Sending Frames with 9 Data Bit
- •Parity Generator
- •Disabling the Transmitter
- •Receiving Frames with 5 to 8 Data Bits
- •Receiving Frames with 9 Data Bits
- •Receiver Error Flags
- •Parity Checker
- •Disabling the Receiver
- •Flushing the Receive Buffer
- •Asynchronous Data Recovery
- •Using MPCM
- •Overview
- •Functional Descriptions
- •Three-wire Mode
- •SPI Slave Operation Example
- •Two-wire Mode
- •Start Condition Detector
- •Alternative USI Usage
- •4-bit Counter
- •12-bit Timer/Counter
- •Software Interrupt
- •Analog Comparator
- •debugWIRE On-chip Debug System
- •Features
- •Overview
- •Physical Interface
- •Software Break Points
- •Limitations of debugWIRE
- •debugWIRE Related Register in I/O Memory
- •Performing a Page Write
- •Reading the Fuse and Lock Bits from Software
- •Preventing Flash Corruption
- •Fuse Bits
- •Latching of Fuses
- •Signature Bytes
- •Calibration Byte
- •Page Size
- •Signal Names
- •Parallel Programming
- •Enter Programming Mode
- •Chip Erase
- •Programming the Flash
- •Programming the EEPROM
- •Reading the Flash
- •Reading the EEPROM
- •Programming the Lock Bits
- •Reading the Signature Bytes
- •Reading the Calibration Byte
- •Serial Downloading
- •Electrical Characteristics
- •Absolute Maximum Ratings*
- •DC Characteristics
- •External Clock Drive Waveforms
- •External Clock Drive
- •Active Supply Current
- •Idle Supply Current
- •Power-down Supply Current
- •Standby Supply Current
- •Pin Pull-up
- •Pin Driver Strength
- •Internal Oscillator Speed
- •Register Summary
- •Instruction Set Summary
- •Ordering Information
- •Packaging Information
- •Errata
- •ATtiny2313 Rev B
- •ATtiny2313 Rev A
- •Changes from Rev. 2514F-08/04 to Rev. 2514G-10/04
- •Changes from Rev. 2514F-08/04 to Rev. 2514G-10/04
- •Changes from Rev. 2514E-04/04 to Rev. 2514F-08/04
- •Changes from Rev. 2514D-03/04 to Rev. 2514E-04/04
- •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
- •Table of Contents
|
|
ATtiny2313 |
Table of Contents |
Features................................................................................................ |
1 |
|
Pin Configurations............................................................................... |
2 |
|
Overview............................................................................................... |
2 |
|
Block Diagram ...................................................................................................... |
3 |
|
Pin Descriptions.................................................................................................... |
5 |
|
About Code Examples......................................................................... |
5 |
|
Disclaimer............................................................................................. |
5 |
|
AVR CPU Core ..................................................................................... |
6 |
|
Introduction ........................................................................................................... |
6 |
|
Architectural Overview.......................................................................................... |
6 |
|
ALU – Arithmetic Logic Unit.................................................................................. |
7 |
|
Status Register ..................................................................................................... |
7 |
|
General Purpose Register File ............................................................................. |
8 |
|
Stack Pointer ...................................................................................................... |
10 |
|
Instruction Execution Timing............................................................................... |
10 |
|
Reset and Interrupt Handling.............................................................................. |
11 |
|
AVR ATtiny2313 Memories ............................................................... |
13 |
|
In-System Reprogrammable Flash Program Memory ........................................ |
13 |
|
SRAM Data Memory........................................................................................... |
14 |
|
EEPROM Data Memory...................................................................................... |
15 |
|
I/O Memory ......................................................................................................... |
20 |
|
System Clock and Clock Options .................................................... |
21 |
|
Clock Systems and their Distribution .................................................................. |
21 |
|
Clock Sources..................................................................................................... |
22 |
|
Default Clock Source .......................................................................................... |
22 |
|
Crystal Oscillator................................................................................................. |
22 |
|
Calibrated Internal RC Oscillator ........................................................................ |
24 |
|
External Clock..................................................................................................... |
26 |
|
128 kHz Internal Oscillator.................................................................................. |
27 |
|
Power Management and Sleep Modes............................................. |
29 |
|
Idle Mode ............................................................................................................ |
29 |
|
Power-down Mode.............................................................................................. |
30 |
|
Standby Mode..................................................................................................... |
30 |
|
Minimizing Power Consumption ......................................................................... |
30 |
|
System Control and Reset ................................................................ |
32 |
|
Internal Voltage Reference ................................................................................. |
37 |
|
Watchdog Timer ................................................................................................. |
38 |
|
|
i |
2543H–AVR–02/05
Interrupts ............................................................................................ |
43 |
Interrupt Vectors in ATtiny2313 .......................................................................... |
43 |
I/O-Ports.............................................................................................. |
45 |
Introduction ......................................................................................................... |
45 |
Ports as General Digital I/O ................................................................................ |
46 |
Alternate Port Functions ..................................................................................... |
50 |
Register Description for I/O-Ports....................................................................... |
57 |
External Interrupts............................................................................. |
58 |
Pin Change Interrupt Timing............................................................................... |
58 |
8-bit Timer/Counter0 with PWM........................................................ |
62 |
Overview............................................................................................................. |
62 |
Timer/Counter Clock Sources............................................................................. |
63 |
Counter Unit........................................................................................................ |
63 |
Output Compare Unit.......................................................................................... |
64 |
Compare Match Output Unit ............................................................................... |
65 |
Modes of Operation ............................................................................................ |
66 |
Timer/Counter Timing Diagrams......................................................................... |
71 |
8-bit Timer/Counter Register Description ........................................................... |
73 |
Timer/Counter0 and Timer/Counter1 Prescalers ............................ |
80 |
16-bit Timer/Counter1........................................................................ |
82 |
Overview............................................................................................................. |
82 |
Accessing 16-bit Registers ................................................................................. |
84 |
Timer/Counter Clock Sources............................................................................. |
88 |
Counter Unit........................................................................................................ |
88 |
Input Capture Unit............................................................................................... |
89 |
Output Compare Units ........................................................................................ |
91 |
Compare Match Output Unit ............................................................................... |
93 |
Modes of Operation ............................................................................................ |
94 |
Timer/Counter Timing Diagrams....................................................................... |
102 |
16-bit Timer/Counter Register Description ....................................................... |
104 |
USART .............................................................................................. |
111 |
Overview........................................................................................................... |
111 |
Clock Generation .............................................................................................. |
112 |
Frame Formats ................................................................................................. |
115 |
USART Initialization.......................................................................................... |
116 |
Data Transmission – The USART Transmitter ................................................. |
118 |
Data Reception – The USART Receiver .......................................................... |
121 |
Asynchronous Data Reception ......................................................................... |
124 |
Multi-processor Communication Mode ............................................................. |
128 |
USART Register Description ............................................................................ |
129 |
ii ATtiny2313
2543H–AVR–02/05
ATtiny2313
Examples of Baud Rate Setting........................................................................ |
134 |
Universal Serial Interface – USI...................................................... |
138 |
Overview........................................................................................................... |
138 |
Functional Descriptions .................................................................................... |
139 |
Alternative USI Usage ...................................................................................... |
144 |
USI Register Descriptions................................................................................. |
144 |
Analog Comparator ......................................................................... |
149 |
debugWIRE On-chip Debug System .............................................. |
151 |
Features............................................................................................................ |
151 |
Overview........................................................................................................... |
151 |
Physical Interface ............................................................................................. |
151 |
Software Break Points ...................................................................................... |
152 |
Limitations of debugWIRE ................................................................................ |
152 |
debugWIRE Related Register in I/O Memory ................................................... |
152 |
Self-Programming the Flash........................................................... |
153 |
Addressing the Flash During Self-Programming .............................................. |
154 |
Memory Programming..................................................................... |
158 |
Program And Data Memory Lock Bits .............................................................. |
158 |
Fuse Bits........................................................................................................... |
159 |
Signature Bytes ................................................................................................ |
160 |
Calibration Byte ................................................................................................ |
160 |
Page Size ......................................................................................................... |
160 |
Parallel Programming Parameters, Pin Mapping, and Commands .................. |
161 |
Serial Programming Pin Mapping ..................................................................... |
163 |
Parallel Programming ....................................................................................... |
163 |
Serial Downloading........................................................................................... |
172 |
Electrical Characteristics................................................................ |
177 |
Absolute Maximum Ratings*............................................................................. |
177 |
DC Characteristics............................................................................................ |
177 |
External Clock Drive Waveforms ...................................................................... |
178 |
External Clock Drive ......................................................................................... |
178 |
Maximum Speed vs. VCC ........................................................................................................................ |
180 |
ATtiny2313 Typical Characteristics ............................................... |
181 |
Register Summary ........................................................................... |
211 |
Instruction Set Summary ................................................................ |
213 |
Ordering Information....................................................................... |
215 |
|
iii |
2543H–AVR–02/05
Packaging Information .................................................................... |
216 |
20P3 ................................................................................................................. |
216 |
20S ................................................................................................................... |
217 |
20M1................................................................................................................. |
218 |
Errata ................................................................................................ |
219 |
ATtiny2313 Rev B............................................................................................. |
219 |
ATtiny2313 Rev A............................................................................................. |
219 |
Datasheet Revision History ............................................................ |
220 |
Changes from Rev. 2514F-08/04 to Rev. 2514G-10/04 ................................... |
220 |
Changes from Rev. 2514F-08/04 to Rev. 2514G-10/04 ................................... |
220 |
Changes from Rev. 2514E-04/04 to Rev. 2514F-08/04 ................................... |
220 |
Changes from Rev. 2514D-03/04 to Rev. 2514E-04/04 ................................... |
220 |
Changes from Rev. 2514C-12/03 to Rev. 2514D-03/04................................... |
221 |
Changes from Rev. 2514B-09/03 to Rev. 2514C-12/03 ................................... |
221 |
Changes from Rev. 2514A-09/03 to Rev. 2514B-09/03 ................................... |
221 |
Table of Contents ................................................................................. |
i |
iv ATtiny2313
2543H–AVR–02/05
Atmel Corporation |
Atmel Operations |
2325 Orchard Parkway
San Jose, CA 95131, USA
Tel: 1(408) 441-0311
Fax: 1(408) 487-2600
Regional Headquarters
Europe
Atmel Sarl
Route des Arsenaux 41 Case Postale 80 CH-1705 Fribourg Switzerland
Tel: (41) 26-426-5555 Fax: (41) 26-426-5500
Asia
Room 1219
Chinachem Golden Plaza
77 Mody Road Tsimshatsui
East Kowloon
Hong Kong
Tel: (852) 2721-9778
Fax: (852) 2722-1369
Japan
9F, Tonetsu Shinkawa Bldg.
1-24-8 Shinkawa
Chuo-ku, Tokyo 104-0033
Japan
Tel: (81) 3-3523-3551
Fax: (81) 3-3523-7581
Memory
2325 Orchard Parkway
San Jose, CA 95131, USA
Tel: 1(408) 441-0311
Fax: 1(408) 436-4314
Microcontrollers
2325 Orchard Parkway
San Jose, CA 95131, USA
Tel: 1(408) 441-0311
Fax: 1(408) 436-4314
La Chantrerie
BP 70602
44306 Nantes Cedex 3, France
Tel: (33) 2-40-18-18-18
Fax: (33) 2-40-18-19-60
ASIC/ASSP/Smart Cards
Zone Industrielle
13106 Rousset Cedex, France
Tel: (33) 4-42-53-60-00
Fax: (33) 4-42-53-60-01
1150 East Cheyenne Mtn. Blvd.
Colorado Springs, CO 80906, USA
Tel: 1(719) 576-3300
Fax: 1(719) 540-1759
Scottish Enterprise Technology Park
Maxwell Building
East Kilbride G75 0QR, Scotland
Tel: (44) 1355-803-000
Fax: (44) 1355-242-743
RF/Automotive
Theresienstrasse 2
Postfach 3535
74025 Heilbronn, Germany
Tel: (49) 71-31-67-0
Fax: (49) 71-31-67-2340
1150 East Cheyenne Mtn. Blvd.
Colorado Springs, CO 80906, USA
Tel: 1(719) 576-3300
Fax: 1(719) 540-1759
Biometrics/Imaging/Hi-Rel MPU/
High Speed Converters/RF Datacom
Avenue de Rochepleine
BP 123
38521 Saint-Egreve Cedex, France
Tel: (33) 4-76-58-30-00
Fax: (33) 4-76-58-34-80
Literature Requests
www.atmel.com/literature
Disclaimer: The information in this document is provided in connection with Atmel products. No license, express or implied, by estoppel or otherwise, to any intellectual property right is granted by this document or in connection with the sale of Atmel products. EXCEPT AS SET FORTH IN ATMEL’S TERMS AND CONDI-
TIONS OF SALE LOCATED ON ATMEL’S WEB SITE, ATMEL ASSUMES NO LIABILITY WHATSOEVER AND DISCLAIMS ANY EXPRESS, IMPLIED OR STATUTORY WARRANTY RELATING TO ITS PRODUCTS INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, CONSEQUENTIAL, PUNITIVE, SPECIAL OR INCIDENTAL DAMAGES (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF PROFITS, BUSINESS INTERRUPTION, OR LOSS OF INFORMATION) ARISING OUT OF THE USE OR INABILITY TO USE THIS DOCUMENT, EVEN IF ATMEL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. Atmel makes no representations or warranties with respect to the accuracy or completeness of the contents of this document and reserves the right to make changes to specifications and product descriptions at any time without notice. Atmel does not make any commitment to update the information contained herein. Atmel’s products are not intended, authorized, or warranted for use as components in applications intended to support or sustain life.
© Atmel Corporation 2005. All rights reserved. Atmel®, logo and combinations thereof, AVR®, and AVR Studio® are registered trademarks, and Everywhere You AreSM are the trademarks of Atmel Corporation or its subsidiaries. Microsoft®, Windows®, Windows NT®, and Windows XP® are the registered trademarks of Microsoft Corporation. Other terms and product names may be trademarks of others.
Printed on recycled paper.
2543H–AVR–02/05