34. Datasheet Revision History

Please note that the referring page numbers in this section are referred to this document. The referring revision in this section are referring to the document revision.

Rev. 8154A – 06/08

1.Initial revision (Based on the ATmega16/L datasheet revision 2466R-AVR-05/08) Changes done comparted ATmega16/L datasheet revision 2466R-AVR-05/08:

-Updated description in “Stack Pointer” on page 12.

-All Electrical characteristics is moved to “Electrical Characteristics” on page 293.

-Register descriptions are moved to sub sections at the end of each chapter.

-Added “Speed Grades” on page 295.

-New graphs in “Typical Characteristics” on page 305.

-New “Ordering Information” on page 339.

344 ATmega16A

8154A–AVR–06/08

ATmega16A

Table of Contents

 

Features .....................................................................................................

1

1

Pin Configurations ...................................................................................

2

2

Overview ...................................................................................................

3

 

2.1

Block Diagram ...................................................................................................

4

 

2.2

Pin Descriptions .................................................................................................

6

3

Resources .................................................................................................

7

4

Data Retention ..........................................................................................

7

5

About Code Examples .............................................................................

7

6

AVR CPU ...................................................................................................

8

 

6.1

Overview ............................................................................................................

8

 

6.2

ALU – Arithmetic Logic Unit ...............................................................................

9

 

6.3

Status Register ..................................................................................................

9

 

6.4

General Purpose Register File ........................................................................

11

 

6.5

Stack Pointer ...................................................................................................

12

 

6.6

Instruction Execution Timing ...........................................................................

13

 

6.7

Reset and Interrupt Handling ...........................................................................

14

7

AVR Memories ........................................................................................

16

 

7.1

Overview ..........................................................................................................

16

 

7.2

In-System Reprogrammable Flash Program Memory .....................................

16

 

7.3

SRAM Data Memory ........................................................................................

17

 

7.4

EEPROM Data Memory ..................................................................................

18

 

7.5

I/O Memory ......................................................................................................

19

 

7.6

Register Description ........................................................................................

19

8

System Clock and Clock Options .........................................................

24

 

8.1

Clock Systems and their Distribution ...............................................................

24

 

8.2

Clock Sources .................................................................................................

25

 

8.3

Default Clock Source .......................................................................................

25

 

8.4

Crystal Oscillator .............................................................................................

26

 

8.5

Low-frequency Crystal Oscillator .....................................................................

27

 

8.6

External RC Oscillator .....................................................................................

28

 

8.7

Calibrated Internal RC Oscillator .....................................................................

29

 

8.8

External Clock .................................................................................................

30

i

8154A–AVR–06/08

 

 

 

 

 

 

 

 

 

 

 

 

8.9

..................................................................................Timer/Counter Oscillator

30

8.10

Register Description ........................................................................................

31

9 Power Management and Sleep Modes .................................................

32

9.1

Overview ..........................................................................................................

32

9.2

Sleep Modes ....................................................................................................

32

9.3

Idle Mode .........................................................................................................

33

9.4

ADC Noise Reduction Mode ............................................................................

33

9.5

Power-down Mode ...........................................................................................

33

9.6

Power-save Mode ............................................................................................

33

9.7

Standby Mode .................................................................................................

34

9.8

Extended Standby Mode .................................................................................

34

9.9

Minimizing Power Consumption ......................................................................

34

9.10

Register Description ........................................................................................

36

10 System Control and Reset ....................................................................

37

10.1

Resetting the AVR ...........................................................................................

37

10.2

Internal Voltage Reference ..............................................................................

40

10.3

Watchdog Timer ..............................................................................................

41

10.4

Register Description ........................................................................................

41

11

Interrupts ................................................................................................

44

 

11.1

Overview ..........................................................................................................

44

 

11.2

Interrupt Vectors ..............................................................................................

44

12

I/O Ports ..................................................................................................

49

 

12.1

Overview ..........................................................................................................

49

 

12.2

Ports as General Digital I/O .............................................................................

50

 

12.3

Alternate Port Functions ..................................................................................

54

 

12.4

Register Description ........................................................................................

65

13

External Interrupts .................................................................................

67

 

13.1

Register Description ........................................................................................

67

14

8-bit Timer/Counter0 with PWM ............................................................

71

 

14.1

Features ..........................................................................................................

71

 

14.2

Overview ..........................................................................................................

71

 

14.3

Timer/Counter Clock Sources .........................................................................

72

 

14.4

Counter Unit ....................................................................................................

72

 

14.5

Output Compare Unit .......................................................................................

73

ii ATmega16A

8154A–AVR–06/08

ATmega16A

14.6

Compare Match Output Unit ............................................................................

75

14.7

Modes of Operation .........................................................................................

76

14.8

Timer/Counter Timing Diagrams .....................................................................

80

14.9

Register Description ........................................................................................

82

15 Timer/Counter0 and Timer/Counter1 Prescalers ................................

86

15.1

Overview ..........................................................................................................

86

15.2

Internal Clock Source ......................................................................................

86

15.3

Prescaler Reset ...............................................................................................

86

15.4

External Clock Source .....................................................................................

86

15.5

Register Description ........................................................................................

87

16 16-bit Timer/Counter1 ............................................................................

88

16.1

Features ..........................................................................................................

88

16.2

Overview ..........................................................................................................

88

16.3

Accessing 16-bit Registers ..............................................................................

91

16.4

Timer/Counter Clock Sources .........................................................................

93

16.5

Counter Unit ....................................................................................................

93

16.6

Input Capture Unit ...........................................................................................

95

16.7

Output Compare Units .....................................................................................

97

16.8

Compare Match Output Unit ............................................................................

98

16.9

Modes of Operation .........................................................................................

99

16.10

Timer/Counter Timing Diagrams ...................................................................

107

16.11

Register Description ......................................................................................

109

17 8-bit Timer/Counter2 with PWM and Asynchronous Operation ......

117

17.1

Features ........................................................................................................

117

17.2

Overview ........................................................................................................

117

17.3

Timer/Counter Clock Sources .......................................................................

118

17.4

Counter Unit ..................................................................................................

118

17.5

Output Compare Unit .....................................................................................

119

17.6

Compare Match Output Unit ..........................................................................

121

17.7

Modes of Operation .......................................................................................

122

17.8

Timer/Counter Timing Diagrams ...................................................................

126

17.9

Asynchronous Operation of the Timer/Counter2 ...........................................

128

17.10

Timer/Counter Prescaler ...............................................................................

130

17.11

Register Description ......................................................................................

130

18 SPI – Serial Peripheral Interface .........................................................

136

iii

8154A–AVR–06/08

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

18.1

 

........................................................................................................Features

136

 

18.2

 

Overview ........................................................................................................

136

 

18.3

 

 

Pin Functionality

141

 

SS

 

18.4

 

Data Modes ...................................................................................................

141

 

18.5

 

Register Description ......................................................................................

143

19

USART

...................................................................................................

 

 

 

 

 

 

146

 

19.1

 

Features ........................................................................................................

146

 

19.2

 

Overview ........................................................................................................

146

 

19.3

 

Clock Generation ...........................................................................................

148

 

19.4

 

Frame Formats ..............................................................................................

151

 

19.5

 

USART Initialization .......................................................................................

152

 

19.6

 

Data Transmission – The USART Transmitter ..............................................

153

 

19.7

 

Data Reception – The USART Receiver .......................................................

156

 

19.8

 

Asynchronous Data Reception ......................................................................

160

 

19.9

 

Multi-processor Communication Mode ..........................................................

163

 

19.10

 

Accessing UBRRH/ UCSRC Registers .........................................................

164

 

19.11

 

Examples of Baud Rate Setting .....................................................................

171

20

Two-wire .....................................................................Serial Interface

175

 

20.1 ........................................................................................................

 

Features

175

 

20.2 ........................................................

 

Two-wire Serial Interface Bus Definition

175

 

20.3 ..................................................................

 

Data Transfer and Frame Format

176

 

20.4 .........................

 

Multi-master Bus Systems, Arbitration and Synchronization

179

 

20.5 .........................................................................

 

Overview of the TWI Module

181

 

20.6 ................................................................................................

 

Using the TWI

183

 

20.7 .....................................................................................

 

Transmission Modes

186

 

20.8 ............................................................

 

Multi-master Systems and Arbitration

199

 

20.9 ......................................................................................

 

Register Description

200

21

Analog ..............................................................................Comparator

204

 

21.1 ...........................................................

 

Analog Comparator Multiplexed Input

204

 

21.2 ......................................................................................

 

Register Description

205

22 Analog .................................................................to Digital Converter

207

 

22.1 ........................................................................................................

 

Features

207

 

22.2 ........................................................................................................

 

Overview

207

 

22.3 .......................................................................................................

 

Operation

208

 

22.4 ....................................................................................

 

Starting a Conversion

209

iv ATmega16A

8154A–AVR–06/08

ATmega16A

22.5

Prescaling and Conversion Timing ................................................................

210

22.6

Changing Channel or Reference Selection ...................................................

213

22.7

ADC Noise Canceler .....................................................................................

215

22.8

ADC Conversion Result .................................................................................

219

22.9

Register Description ......................................................................................

221

22.10

ADLAR = 0 .....................................................................................................

224

22.11

ADLAR = 1 .....................................................................................................

224

23 JTAG Interface and On-chip Debug System ......................................

226

23.1

Features ........................................................................................................

226

23.2

Overview ........................................................................................................

226

23.3

TAP – Test Access Port ................................................................................

226

23.4

TAP Controller ...............................................................................................

228

23.5

Using the Boundary-scan Chain ....................................................................

229

23.6

Using the On-chip Debug System .................................................................

229

23.7

On-chip Debug Specific JTAG Instructions ...................................................

230

23.8

Using the JTAG Programming Capabilities ...................................................

231

23.9

Register Description ......................................................................................

231

23.10

Bibliography ...................................................................................................

231

24 IEEE 1149.1 (JTAG) Boundary-scan ...................................................

232

24.1

Features ........................................................................................................

232

24.2

Overview ........................................................................................................

232

24.3

Data Registers ...............................................................................................

232

24.4

Boundary-scan Specific JTAG Instructions ...................................................

234

24.5

Boundary-scan Chain ....................................................................................

235

24.6

Boundary-scan Order ....................................................................................

245

24.7

Boundary-scan Description Language Files ..................................................

249

24.8

Register Description ......................................................................................

249

25 Boot Loader Support – Read-While-Write Self-Programming .........

250

25.1

Features ........................................................................................................

250

25.2

Overview ........................................................................................................

250

25.3

Application and Boot Loader Flash Sections .................................................

250

25.4

Read-While-Write and no Read-While-Write Flash Sections ........................

251

25.5

Boot Loader Lock Bits ...................................................................................

253

25.6

Entering the Boot Loader Program ................................................................

254

25.7

Addressing the Flash during Self-Programming ............................................

256

v

8154A–AVR–06/08

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

25.8

..........................................................................Self - Programming the Flash

257

26

Memory Programming .........................................................................

264

 

26.1

Program And Data Memory Lock Bits ...........................................................

264

 

26.2

Fuse Bits ........................................................................................................

265

 

26.3

Signature Bytes .............................................................................................

266

 

26.4

Calibration Byte .............................................................................................

266

 

26.5

Page Size ......................................................................................................

267

 

26.6

Parallel Programming Parameters, Pin Mapping, and Commands

...............267

 

26.7

Parallel Programming ....................................................................................

269

 

26.8

Serial Downloading ........................................................................................

276

 

26.9

SPI Serial Programming Characteristics .......................................................

280

 

26.10

Programming via the JTAG Interface ............................................................

280

27

Electrical Characteristics ....................................................................

293

 

27.1

Absolute Maximum Ratings* .........................................................................

293

 

27.2

DC Characteristics .........................................................................................

293

 

27.3

Speed Grades ...............................................................................................

295

 

27.4

Clock Characteristics .....................................................................................

295

 

27.5

System and Reset Characteristics ................................................................

296

 

27.6

External Interrupts Characteristics ................................................................

297

 

27.7

Two - wire Serial Interface Characteristics ......................................................

297

 

27.8

SPI Timing Characteristics ............................................................................

298

 

27.9

ADC Characteristics .....................................................................................

301

 

27.10

Parallel Programming Characteristics ...........................................................

302

28

Typical Characteristics ........................................................................

305

29

Register Summary ...............................................................................

334

30

Instruction Set Summary .....................................................................

336

31

Ordering Information ...........................................................................

339

32

Packaging Information ........................................................................

340

33

Errata

 

 

343

 

33.1

ATmega16A rev. N to rev. Q .........................................................................

343

34

Datasheet .................................................................Revision History

344

 

Table of .......................................................................................Contents

i

vi ATmega16A

8154A–AVR–06/08

ATmega16A

vii

8154A–AVR–06/08

Headquarters

International

 

 

 

 

 

 

 

Atmel Corporation

 

Atmel Asia

Atmel Europe

Atmel Japan

2325 Orchard Parkway

 

Room 1219

Le Krebs

9F, Tonetsu Shinkawa Bldg.

San Jose, CA 95131

 

Chinachem Golden Plaza

8, Rue Jean-Pierre Timbaud

1-24-8 Shinkawa

USA

 

77 Mody Road Tsimshatsui

BP 309

Chuo-ku, Tokyo 104-0033

Tel: 1(408) 441-0311

 

East Kowloon

78054 Saint-Quentin-en-

Japan

Fax: 1(408) 487-2600

 

Hong Kong

Yvelines Cedex

Tel: (81) 3-3523-3551

 

 

Tel: (852) 2721-9778

France

Fax: (81) 3-3523-7581

 

 

Fax: (852) 2722-1369

Tel: (33) 1-30-60-70-00

 

 

 

 

Fax: (33) 1-30-60-71-11

 

Product Contact

Web Site

Technical Support

Sales Contact

www.atmel.com

avr@atmel.com

www.atmel.com/contacts

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. Unless specifically provided otherwise, Atmel products are not suitable for, and shall not be used in, automotive applications. Atmel’s products are not intended, authorized, or warranted for use as components in applications intended to support or sustain life.

© 2008 Atmel Corporation. All rights reserved. Atmel®, logo and combinations thereof, AVR® and others are registered trademarks or trademarks of Atmel Corporation or its subsidiaries. Other terms and product names may be trademarks of others.

8154A–AVR–06/08

Соседние файлы в папке МК