Features

• High-performance, Low-power AVR® 8-bit Microcontroller • Advanced RISC Architecture
– 131 Powerful Instructions – Most Single-clock Cycle Execution – 32 x 8 General Purpose Working Registers – Fully Static Operation – Up to 16 MIPS Throughput at 16 MHz – On-chip 2-cycle Multiplier Nonvolatile Program and Data Memories – 16K Bytes of In-System Self-Programmable Flash Endurance: 10,000 Write/Erase Cycles – Optional Boot Code Section with Independent Lock Bits In-System Programming by On-chip Boot Program True Read-While-Write Operation – 512 Bytes EEPROM Endurance: 100,000 Write/Erase Cycles – 1K Byte Internal SRAM – Programming Lock for Software Security JTAG (IEEE std. 1149.1 Compliant) Interface – Boundary-scan Capabilities According to the JTAG Standard – Extensive On-chip Debug Support – Programming of Flash, EEPROM, Fuses, and Lock Bits through the JTAG Interface Peripheral Features – Two 8-bit Timer/Counters with Separate Prescalers and Compare Modes – One 16-bit Timer/Counter with Separate Prescaler, Compare Mode, and Capture Mode – Real Time Counter with Separate Oscillator – Four PWM Channels – 8-channel, 10-bit ADC 8 Single-ended Channels 7 Differential Channels in TQFP Package Only 2 Differential Channels with Programmable Gain at 1x, 10x, or 200x – Byte-oriented Two-wire Serial Interface – Programmable Serial USART – Master/Slave SPI Serial Interface – Programmable Watchdog Timer with Separate On-chip Oscillator – On-chip Analog Comparator Special Microcontroller Features – Power-on Reset and Programmable Brown-out Detection – Internal Calibrated RC Oscillator – External and Internal Interrupt Sources – Six Sleep Modes: Idle, ADC Noise Reduction, Power-save, Power-down, Standby and Extended Standby I/O and Packages – 32 Programmable I/O Lines – 40-pin PDIP, 44-lead TQFP, and 44-pad MLF Operating Voltages – 2.7 - 5.5V for ATmega16L – 4.5 - 5.5V for ATmega16 Speed Grades – 0 - 8 MHz for ATmega16L – 0 - 16 MHz for ATmega16 Power Consumption @ 1 MHz, 3V, and 25°C for ATmega16L – Active: 1.1 mA – Idle Mode: 0.35 mA – Power-down Mode: < 1 µA

8-bit Microcontroller with 16K Bytes In-System Programmable Flash ATmega16 ATmega16L Summary

• • • •

2466HS–AVR–12/03

Note: This is a summary document. A complete document is available on our Web site at www.atmel.com.

Pin Configurations

Figure 1. Pinouts ATmega16
PDIP
(XCK/T0) PB0 (T1) PB1 (INT2/AIN0) PB2 (OC0/AIN1) PB3 (SS) PB4 (MOSI) PB5 (MISO) PB6 (SCK) PB7 RESET VCC GND XTAL2 XTAL1 (RXD) PD0 (TXD) PD1 (INT0) PD2 (INT1) PD3 (OC1B) PD4 (OC1A) PD5 (ICP1) PD6 PA0 (ADC0) PA1 (ADC1) PA2 (ADC2) PA3 (ADC3) PA4 (ADC4) PA5 (ADC5) PA6 (ADC6) PA7 (ADC7) AREF GND AVCC PC7 (TOSC2) PC6 (TOSC1) PC5 (TDI) PC4 (TDO) PC3 (TMS) PC2 (TCK) PC1 (SDA) PC0 (SCL) PD7 (OC2)

TQFP/MLF
PB4 (SS) PB3 (AIN1/OC0) PB2 (AIN0/INT2) PB1 (T1) PB0 (XCK/T0) GND VCC PA0 (ADC0) PA1 (ADC1) PA2 (ADC2) PA3 (ADC3) (MOSI) PB5 (MISO) PB6 (SCK) PB7 RESET VCC GND XTAL2 XTAL1 (RXD) PD0 (TXD) PD1 (INT0) PD2

PA4 (ADC4) PA5 (ADC5) PA6 (ADC6) PA7 (ADC7) AREF GND AVCC PC7 (TOSC2) PC6 (TOSC1) PC5 (TDI) PC4 (TDO)

Disclaimer

Typical values contained in this datasheet are based on simulations and characterization of other AVR microcontrollers manufactured on the same process technology. Min and Max values will be available after the device is characterized.

2

ATmega16(L)
2466HS–AVR–12/03

(INT1) (OC1B) (OC1A) (ICP1) (OC2)

PD3 PD4 PD5 PD6 PD7 VCC GND (SCL) PC0 (SDA) PC1 (TCK) PC2 (TMS) PC3

PD7 3 2466HS–AVR–12/03 .PC7 Block Diagram PORTA DRIVERS/BUFFERS PORTC DRIVERS/BUFFERS GND PORTA DIGITAL INTERFACE PORTC DIGITAL INTERFACE AVCC MUX & ADC AREF PROGRAM COUNTER ADC INTERFACE TWI STACK POINTER TIMERS/ COUNTERS OSCILLATOR PROGRAM FLASH SRAM INTERNAL OSCILLATOR XTAL1 INSTRUCTION REGISTER GENERAL PURPOSE REGISTERS X WATCHDOG TIMER OSCILLATOR XTAL2 MCU CTRL. INTERFACE PORTB DIGITAL INTERFACE PORTD DIGITAL INTERFACE PORTB DRIVERS/BUFFERS PORTD DRIVERS/BUFFERS PB0 .PB7 PD0 . Block Diagram PA0 . By executing powerful instructions in a single clock cycle. the ATmega16 achieves throughputs approaching 1 MIPS per MHz allowing the system designer to optimize power consumption versus processing speed. Figure 2.ATmega16(L) Overview The ATmega16 is a low-power CMOS 8-bit microcontroller based on the AVR enhanced RISC architecture. & TIMING RESET INSTRUCTION DECODER Y Z CONTROL LINES ALU INTERRUPT UNIT INTERNAL CALIBRATED OSCILLATOR AVR CPU STATUS REGISTER EEPROM PROGRAMMING LOGIC SPI USART + - COMP.PA7 VCC PC0 .

by a conventional nonvolatile memory programmer. three flexible Timer/Counters with compare modes. The device is manufactured using Atmel’s high density nonvolatile memory technology. and interrupt system to continue functioning. allowing the user to maintain a timer base while the rest of the device is sleeping.PA0) Digital supply voltage. the Asynchronous Timer continues to run. This allows very fast start-up combined with low-power consumption. Port A serves as the analog inputs to the A/D Converter. a byte oriented Two-wire Serial Interface. they will source current if the internal pull-up resistors are activated. Timer/Counters. On-chip Debugging support and programming. The ADC Noise Reduction mode stops the CPU and all I/O modules except Asynchronous Timer and ADC. and six software selectable power saving modes. All the 32 registers are directly connected to the Arithmetic Logic Unit (ALU).. 10-bit ADC with optional differential input stage with programmable gain (TQFP package only). The Idle mode stops the CPU while allowing the USART. both the main Oscillator and the Asynchronous Timer continue to run. Pin Descriptions VCC GND Port A (PA7. In Extended Standby mode. The Power-down mode saves the register contents but freezes the Oscillator. providing true Read-While-Write operation. Port A also serves as an 8-bit bi-directional I/O port. In Power-save mode. allowing two independent registers to be accessed in one single instruction executed in one clock cycle. The boot program can use any interface to download the application program in the Application Flash memory. and evaluation kits. in-circuit emulators. a JTAG interface for Boundary-scan. The Port A output buffers have symmetrical drive characteristics with both high sink and source capability. even if the clock is not running. The ATmega16 AVR is supported with a full suite of program and system development tools including: C compilers. The On-chip ISP Flash allows the program memory to be reprogrammed in-system through an SPI serial interface. disabling all other chip functions until the next External Interrupt or Hardware Reset.The AVR core combines a rich instruction set with 32 general purpose working registers. a serial programmable USART. an SPI serial port. In Standby mode. 512 bytes EEPROM. The Port A pins are tri-stated when a reset condition becomes active. The resulting architecture is more code efficient while achieving throughputs up to ten times faster than conventional CISC microcontrollers. Internal and External Interrupts. if the A/D Converter is not used. SPI port. the Atmel ATmega16 is a powerful microcontroller that provides a highly-flexible and cost-effective solution to many embedded control applications. By combining an 8-bit RISC CPU with In-System Self-Programmable Flash on a monolithic chip. the crystal/resonator Oscillator is running while the rest of the device is sleeping. A/D Converter. 1K byte SRAM. When pins PA0 to PA7 are used as inputs and are externally pulled low. Software in the Boot Flash section will continue to run while the Application Flash section is updated. macro assemblers. Ground. Two-wire interface. Port pins can provide internal pull-up resistors (selected for each bit). 4 ATmega16(L) 2466HS–AVR–12/03 . or by an On-chip Boot program running on the AVR core. The ATmega16 provides the following features: 16K bytes of In-System Programmable Flash Program memory with Read-While-Write capabilities. 32 general purpose working registers. 32 general purpose I/O lines. SRAM. an 8-channel. program debugger/simulators. a programmable Watchdog Timer with Internal Oscillator. to minimize switching noise during ADC conversions.

AREF is the analog reference pin for the A/D Converter. If the JTAG interface is enabled. The Port C pins are tri-stated when a reset condition becomes active.ATmega16(L) Port B (PB7. The Port B output buffers have symmetrical drive characteristics with both high sink and source capability. XTAL1 XTAL2 AVCC AREF 5 2466HS–AVR–12/03 . The Port C output buffers have symmetrical drive characteristics with both high sink and source capability.. Port C pins that are externally pulled low will source current if the pull-up resistors are activated. Port B pins that are externally pulled low will source current if the pull-up resistors are activated. As inputs. Port D (PD7. The Port B pins are tri-stated when a reset condition becomes active. even if the clock is not running. If the ADC is used. Input to the inverting Oscillator amplifier and input to the internal clock operating circuit. Port C (PC7. The minimum pulse length is given in Table 15 on page 36. The Port D output buffers have symmetrical drive characteristics with both high sink and source capability. even if the clock is not running. the pull-up resistors on pins PC5(TDI).PC0) Port C is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). Port D pins that are externally pulled low will source current if the pull-up resistors are activated. Port D also serves the functions of various special features of the ATmega16 as listed on page 61. A low level on this pin for longer than the minimum pulse length will generate a reset. RESET Reset Input. As inputs. As inputs.. Output from the inverting Oscillator amplifier. The Port D pins are tri-stated when a reset condition becomes active. even if the ADC is not used. even if the clock is not running. Port B also serves the functions of various special features of the ATmega16 as listed on page 56. even if the clock is not running..PB0) Port B is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). Port C also serves the functions of the JTAG interface and other special features of the ATmega16 as listed on page 59.PD0) Port D is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). PC3(TMS) and PC2(TCK) will be activated even if a reset occurs. it should be connected to VCC through a low-pass filter. It should be externally connected to VCC. Shorter pulses are not guaranteed to generate a reset. AVCC is the supply voltage pin for Port A and the A/D Converter.

132 84.133.219 109 112 113 113 113 113 113 113 114 114 Timer/Counter1 – Counter Register High Byte Timer/Counter1 – Counter Register Low Byte Timer/Counter1 – Output Compare Register A High Byte Timer/Counter1 – Output Compare Register A Low Byte Timer/Counter1 – Output Compare Register B High Byte Timer/Counter1 – Output Compare Register B Low Byte Timer/Counter1 – Input Capture Register High Byte Timer/Counter1 – Input Capture Register Low Byte FOC2 WGM20 COM21 COM20 WGM21 CS22 CS21 CS20 Timer/Counter2 (8 Bits) Timer/Counter2 Output Compare Register – – URSEL URSEL – – – – UMSEL – – – – UPM1 – – WDTOE – UPM0 – USBS – – AS2 WDE TCN2UB WDP2 UCSZ1 OCR2UB WDP1 UBRR[11:8] UCSZ0 – UCPOL EEAR8 TCR2UB WDP0 127 129 129 130 41 165 164 17 17 17 EEPROM Address Register Low Byte EEPROM Data Register – PORTA7 DDA7 PINA7 PORTB7 DDB7 PINB7 PORTC7 DDC7 PINC7 PORTD7 DDD7 PIND7 SPI Data Register SPIF SPIE RXC RXCIE ACD REFS1 ADEN WCOL SPE TXC TXCIE ACBG REFS0 ADSC – DORD UDRE UDRIE ACO ADLAR ADATE – MSTR FE RXEN ACI MUX4 ADIF – CPOL DOR TXEN ACIE MUX3 ADIE – CPHA PE UCSZ2 ACIC MUX2 ADPS2 – SPR1 U2X RXB8 ACIS1 MUX1 ADPS1 SPI2X SPR0 MPCM TXB8 ACIS0 MUX0 ADPS0 – PORTA6 DDA6 PINA6 PORTB6 DDB6 PINB6 PORTC6 DDC6 PINC6 PORTD6 DDD6 PIND6 – PORTA5 DDA5 PINA5 PORTB5 DDB5 PINB5 PORTC5 DDC5 PINC5 PORTD5 DDD5 PIND5 – PORTA4 DDA4 PINA4 PORTB4 DDB4 PINB4 PORTC4 DDC4 PINC4 PORTD4 DDD4 PIND4 EERIE PORTA3 DDA3 PINA3 PORTB3 DDB3 PINB3 PORTC3 DDC3 PINC3 PORTD3 DDD3 PIND3 EEMWE PORTA2 DDA2 PINA2 PORTB2 DDB2 PINB2 PORTC2 DDC2 PINC2 PORTD2 DDD2 PIND2 EEWE PORTA1 DDA1 PINA1 PORTB1 DDB1 PINB1 PORTC1 DDC1 PINC1 PORTD1 DDD1 PIND1 EERE PORTA0 DDA0 PINA0 PORTB0 DDB0 PINB0 PORTC0 DDC0 PINC0 PORTD0 DDD0 PIND0 17 64 64 64 64 64 64 65 65 65 65 65 65 140 140 138 161 162 163 165 200 215 217 218 218 180 USART I/O Data Register USART Baud Rate Register Low Byte ADC Data Register High Byte ADC Data Register Low Byte Two-wire Serial Interface Data Register TWA6 TWA5 TWA4 TWA3 TWA2 TWA1 TWA0 TWGCE 180 6 ATmega16(L) 2466HS–AVR–12/03 . 67. 132 249 178 30. 67 68 83.Register Summary Address $3F ($5F) $3E ($5E) $3D ($5D) $3C ($5C) $3B ($5B) $3A ($5A) $39 ($59) $38 ($58) $37 ($57) $36 ($56) $35 ($55) $34 ($54) $33 ($53) $32 ($52) $31(1) ($51)(1) $30 ($50) $2F ($4F) $2E ($4E) $2D ($4D) $2C ($4C) $2B ($4B) $2A ($4A) $29 ($49) $28 ($48) $27 ($47) $26 ($46) $25 ($45) $24 ($44) $23 ($43) $22 ($42) $21 ($41) $20(2) ($40)(2) $1F ($3F) $1E ($3E) $1D ($3D) $1C ($3C) $1B ($3B) $1A ($3A) $19 ($39) $18 ($38) $17 ($37) $16 ($36) $15 ($35) $14 ($34) $13 ($33) $12 ($32) $11 ($31) $10 ($30) $0F ($2F) $0E ($2E) $0D ($2D) $0C ($2C) $0B ($2B) $0A ($2A) $09 ($29) $08 ($28) $07 ($27) $06 ($26) $05 ($25) $04 ($24) $03 ($23) $02 ($22) Name SREG SPH SPL OCR0 GICR GIFR TIMSK TIFR SPMCR TWCR MCUCR MCUCSR TCCR0 TCNT0 OSCCAL OCDR SFIOR TCCR1A TCCR1B TCNT1H TCNT1L OCR1AH OCR1AL OCR1BH OCR1BL ICR1H ICR1L TCCR2 TCNT2 OCR2 ASSR WDTCR UBRRH UCSRC EEARH EEARL EEDR EECR PORTA DDRA PINA PORTB DDRB PINB PORTC DDRC PINC PORTD DDRD PIND SPDR SPSR SPCR UDR UCSRA UCSRB UBRRL ACSR ADMUX ADCSRA ADCH ADCL TWDR TWAR Bit 7 I – SP7 INT1 INTF1 OCIE2 OCF2 SPMIE TWINT SM2 JTD FOC0 Bit 6 T – SP6 INT0 INTF0 TOIE2 TOV2 RWWSB TWEA SE ISC2 WGM00 Bit 5 H – SP5 INT2 INTF2 TICIE1 ICF1 – TWSTA SM1 – COM01 Bit 4 S – SP4 – – OCIE1A OCF1A RWWSRE TWSTO SM0 JTRF COM00 Bit 3 V – SP3 – – OCIE1B OCF1B BLBSET TWWC ISC11 WDRF WGM01 Bit 2 N SP10 SP2 – – TOIE1 TOV1 PGWRT TWEN ISC10 BORF CS02 Bit 1 Z SP9 SP1 IVSEL – OCIE0 OCF0 PGERS – ISC01 EXTRF CS01 Bit 0 C SP8 SP0 IVCE – TOIE0 TOV0 SPMEN TWIE ISC00 PORF CS00 Page 7 10 10 83 46.86. 229 81 83 28 225 Timer/Counter0 Output Compare Register Timer/Counter0 (8 Bits) Oscillator Calibration Register On-Chip Debug Register ADTS2 COM1A1 ICNC1 ADTS1 COM1A0 ICES1 ADTS0 COM1B1 – – COM1B0 WGM13 ACME FOC1A WGM12 PUD FOC1B CS12 PSR2 WGM11 CS11 PSR10 WGM10 CS10 55.199. 115. 66 39. 114.

3. 7 2466HS–AVR–12/03 . reserved bits should be written to zero if accessed. writing a one back into any flag read as set. 4. Some of the Status Flags are cleared by writing a logical one to them. When the OCDEN Fuse is unprogrammed.ATmega16(L) Address $01 ($21) $00 ($20) Name TWSR TWBR Bit 7 TWS7 Bit 6 TWS6 Bit 5 TWS5 Bit 4 TWS4 Bit 3 TWS3 Bit 2 – Bit 1 TWPS1 Bit 0 TWPS0 Page 179 178 Two-wire Serial Interface Bit Rate Register Notes: 1. For compatibility with future devices. the OSCCAL Register is always accessed on this address. Refer to the debugger specific documentation for details on how to use the OCDR Register. Note that the CBI and SBI instructions will operate on all bits in the I/O Register. Refer to the USART description for details on how to access UBRRH and UCSRC. 2. The CBI and SBI instructions work with registers $00 to $1F only. Reserved I/O memory addresses should never be written. thus clearing the flag.

C.N.C None None None None None None None I None Z. Rr Rd. b Rr.K Rd.C.N.K) Rd ← Rd + 1 Rd ← Rd − 1 Rd ← Rd • Rd Rd ← Rd ⊕ Rd Rd ← $FF R1:R0 ← Rd x Rr R1:R0 ← Rd x Rr R1:R0 ← Rd x Rr Flags Z.N.H Z.N.C Rdh:Rdl ← Rdh:Rdl . b s. k s.V.N.N.V Z.N.H Z.K Rd.H Z.V.V.C.H Z.Rr .N.C Z.C.C.H None None None None None None None None None None None None None None None None None None None None None None #Clocks 1 1 2 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 3 3 3 4 4 4 1/2/3 1 1 1 1/2/3 1/2/3 1/2/3 1/2/3 1/2 1/2 1/2 1/2 1/2 1/2 1/2 1/2 1/2 1/2 1/2 1/2 1/2 1/2 1/2 1/2 1/2 1/2 ARITHMETIC AND LOGIC INSTRUCTIONS 1 R1:R0 ← (Rd x Rr) << 1 R1:R0 ← (Rd x Rr) << 1 PC ← PC + k + 1 PC ← Z PC ← k PC ← PC + k + 1 PC ← Z PC ← k PC ← STACK PC ← STACK if (Rd = Rr) PC ← PC + 2 or 3 Rd − Rr Rd − Rr − C Rd − K 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 (P(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 R1:R0 ← (Rd x Rr) << BRANCH INSTRUCTIONS 8 ATmega16(L) 2466HS–AVR–12/03 . Subtract Immediate from Word Logical AND Registers Logical AND Register and Constant Logical OR Registers Logical OR Register and Constant Exclusive OR Registers One’s Complement Two’s Complement Set Bit(s) in Register Clear Bit(s) in Register Increment Decrement Test for Zero or Minus Clear Register Set Register Multiply Unsigned Multiply Signed Multiply Signed with Unsigned Fractional Multiply Unsigned Fractional Multiply Signed Fractional Multiply Signed with Unsigned Relative Jump Indirect Jump to (Z) Direct Jump Relative Subroutine Call Indirect Call to (Z) Direct Subroutine Call Subroutine Return Interrupt Return Compare.V Z.Rr Rd ← Rd . Rr Rd. N. K Rd.Rr Rd.N. N.K Rd Rd Rd Rd Rd Rd. Rr Rd.V Z. Skip if Equal Compare Compare with Carry Compare Register with Immediate Skip if Bit in Register Cleared Skip if Bit in Register is Set Skip if Bit in I/O Register Cleared Skip if Bit in I/O Register is Set Branch if Status Flag Set Branch if Status Flag Cleared Branch if Equal Branch if Not Equal Branch if Carry Set Branch if Carry Cleared Branch if Same or Higher Branch if Lower Branch if Minus Branch if Plus Branch if Greater or Equal.N. b P.N. Rr Rd Rd Rd.H Z. Rr k Description Add two Registers Add with Carry two Registers Add Immediate to Word Subtract two Registers Subtract Constant from Register Subtract with Carry two Registers Subtract with Carry Constant from Reg.V.V.Rr Rd.N.V Z. Rr Rd. K Rd.N.C.V.S Z. N. k k k k k k k k k k k k k k k k k k k k Operands Rd.C. b P.N.K 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 .V None Z.K Rd ← Rd . Rr Rd.K Rd.K Rr. Rr Rd.S Z.C Z.V Z.Rr Rd.C.V Z. K Rdl. Rr Rd. Signed Branch if Half Carry Flag Set Branch if Half Carry Flag Cleared Branch if T Flag Set Branch if T Flag Cleared Branch if Overflow Flag is Set Branch if Overflow Flag is Cleared Operation Rd ← Rd + Rr Rd ← Rd + Rr + C Rdh:Rdl ← Rdh:Rdl + K Rd ← Rd . Signed Branch if Less Than Zero.V Z.N.V.V. K Rd.C.N.C Z. Rr Rd.Instruction Set Summary Mnemonics ADD ADC ADIW SUB SUBI SBC SBCI SBIW AND ANDI OR ORI EOR COM NEG SBR CBR INC DEC TST CLR SER MUL MULS MULSU FMUL FMULS FMULSU RJMP IJMP JMP RCALL ICALL CALL RET RETI CPSE CP CPC CPI SBRC SBRS SBIC SBIS BRBS BRBC BREQ BRNE BRCS BRCC BRSH BRLO BRMI BRPL BRGE BRLT BRHS BRHC BRTS BRTC BRVS BRVC Rd.N.C.K .V Z.C.C Z.V Z. Rr Rd.N.C Z.C Rd ← Rd .V.H Z.C.N.V Z.V.H Z.H Z.V Z. Rr Rdl.C. Rr Rd.V.H Z.V.N.N.

Z+ Rd. X ← X + 1 X ← X . Rr Rd.Y+q Rd. K Rd. Z ← Z+1 Z ← Z . Store Indirect Store Indirect and Post-Inc. Load Indirect and Pre-Dec. Y Rd. n=0.b) ← 1 I/O(P. Y ← Y + 1 Y ← Y . Rd ← (Y) Rd ← (Y + q) Rd ← (Z) Rd ← (Z).C. Rr .ATmega16(L) Mnemonics BRIE BRID MOV MOVW LDI LD LD LD LD LD LD LDD LD LD LD LDD LDS ST ST ST ST ST ST STD ST ST ST STD STS LPM LPM LPM SPM IN OUT PUSH POP SBI CBI LSL LSR ROL ROR ASR SWAP BSET BCLR BST BLD SEC CLC SEN CLN SEZ CLZ SEI CLI SES CLS SEV Rd. Rr Rr Rd P. X ← X + 1 X ← X .Y Rd. Rr Y+q. Operation if ( I = 1) then PC ← PC + k + 1 if ( I = 0) then PC ← PC + k + 1 Rd ← Rr Rd+1:Rd ← Rr+1:Rr Rd ← K Rd ← (X) Rd ← (X). b Rd.Y. k X.X.C←Rd(0) Rd(n) ← Rd(n+1).. Rr Description Branch if Interrupt Enabled Branch if Interrupt Disabled Move Between Registers Copy Register Word Load Immediate Load Indirect Load Indirect and Post-Inc.V None SREG(s) SREG(s) T None C C N N Z Z I I S S V #Clocks 1/2 1/2 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 1 1 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 DATA TRANSFER INSTRUCTIONS BIT AND BIT-TEST INSTRUCTIONS CLV SET CLT SEH Clear Twos Complement Overflow Set T in SREG Clear T in SREG Set Half Carry Flag in SREG V←0 T←1 T←0 H←1 V T T H 1 1 1 1 9 2466HS–AVR–12/03 . Rd(7) ← 0 Rd(0)←C. Y ← Y + 1 Y ← Y .Rd(n)← Rd(n+1). Store Indirect with Displacement Store Direct to SRAM Load Program Memory Load Program Memory Load Program Memory and Post-Inc Store Program Memory In Port Out Port Push Register on Stack Pop Register from Stack Set Bit in I/O Register Clear Bit in I/O Register Logical Shift Left Logical Shift Right Rotate Left Through Carry Rotate Right Through Carry Arithmetic Shift Right Swap Nibbles Flag Set Flag Clear Bit Store from Register to T Bit load from T to Register Set Carry Clear Carry Set Negative Flag Clear Negative Flag Set Zero Flag Clear Zero Flag Global Interrupt Enable Global Interrupt Disable Set Signed Test Flag Clear Signed Test Flag Set Twos Complement Overflow. (Z) ← Rr (Z + q) ← Rr (k) ← Rr R0 ← (Z) Rd ← (Z) Rd ← (Z).V Z. Load Indirect Load Indirect and Post-Inc. Rd(0) ← 0 Rd(n) ← Rd(n+1).Rd(7.1. Store Indirect and Pre-Dec. Rr Z+. Rd ← (Z) Rd ← (Z + q) Rd ← (k) (X) ← Rr (X) ← Rr.C.0)←Rd(7.N. Rr Rd.V Z. Load Indirect and Pre-Dec. Load Indirect and Pre-Dec. . Rr X+.C←Rd(7) Rd(7)←C.C.1.N.X Rd. X+ Rd. b Rd. (X) ← Rr (Y) ← Rr (Y) ← Rr.6 Rd(3.1.b Rd Rd Rd Rd Rd Rd s s Rr. Rr Y.V Z.b) ← 0 Rd(n+1) ← Rd(n).N. Z Rd. Z+ Operands k k Rd. Z Rd. .b P. Store Indirect and Pre-Dec. Rd ← (X) Rd ← (Y) Rd ← (Y).Rd(n+1)← Rd(n). (Y) ← Rr (Y + q) ← Rr (Z) ← Rr (Z) ← Rr.N. Rr -Z. Z+q Rd. Store Indirect with Displacement Store Indirect Store Indirect and Post-Inc.4)←Rd(3... Load Indirect with Displacement Load Indirect Load Indirect and Post-Inc..1. P P.Rr Z.4). Load Indirect with Displacement Load Direct from SRAM Store Indirect Store Indirect and Post-Inc. -Z Rd. Rr Z+q.0) SREG(s) ← 1 SREG(s) ← 0 T ← Rr(b) Rd(b) ← T C←1 C←0 N←1 N←0 Z←1 Z←0 I←1 I← 0 S←1 S←0 V←1 Flags None None None None None None None None None None None None None None None None None None None None None None None None None None None None None None None None None None None None None None None Z. Rr . Store Indirect and Pre-Dec.C. Z ← Z+1 (Z) ← R1:R0 Rd ← P P ← Rr STACK ← Rr Rd ← STACK I/O(P.C. Z ← Z + 1 Z ← Z .1.V Z. X Rd.N.1. Y+ Rd.Rr k.. Rr Y+.

Mnemonics Operands Description Clear Half Carry Flag in SREG No Operation Sleep Watchdog Reset Break Operation H←0 H Flags #Clocks 1 1 1 1 N/A CLH MCU CONTROL INSTRUCTIONS NOP SLEEP WDR BREAK (see specific descr. for WDR/timer) For On-Chip Debug Only None None None None 10 ATmega16(L) 2466HS–AVR–12/03 . for Sleep function) (see specific descr.

5V Ordering Code ATmega16L-8AC ATmega16L-8PC ATmega16L-8MC ATmega16L-8AI ATmega16L-8PI ATmega16L-8MI 16 4. Thin (1. 7 x 7 x 1. Micro Lead Frame Package (MLF) 11 2466HS–AVR–12/03 .5.5 . Plastic Dual Inline Package (PDIP) 44-pad.ATmega16(L) Ordering Information Speed (MHz) 8 Power Supply 2. lead pitch 0.0 mm body.0 mm) Plastic Gull Wing Quad Flat Package (TQFP) 40-pin.50 mm.5.600” Wide.5V ATmega16-16AC ATmega16-16PC ATmega16-16MC ATmega16-16AI ATmega16-16PI ATmega16-16MI Package 44A 40P6 44M1 44A 40P6 44M1 44A 40P6 44M1 44A 40P6 44M1 Operation Range Commercial (0oC to 70oC) Industrial (-40oC to 85oC) Commercial (0oC to 70oC) Industrial (-40oC to 85oC) Package Type 44A 40P6 44M1 44-lead.7 . 0.

Allowable protrusion is 0. B R 12 ATmega16(L) 2466HS–AVR–12/03 .45 NOM – – 1.Packaging Information 44A PIN 1 B PIN 1 IDENTIFIER e E1 E D1 D C 0˚~7˚ A1 L COMMON DIMENSIONS (Unit of Measure = mm) SYMBOL A A1 A2 D D1 E MIN – 0.90 0. 3.90 11.45 0.75 Note 2 Note 2 NOTE A2 A Notes: 1.10 mm maximum.25 10.25 mm per side.00 10. 44-lead.00 – – – 0.20 0.80 TYP MAX 1.25 10.10 0. This package conforms to JEDEC reference MS-026.8 mm Lead Pitch.75 9. 10 x 10 mm Body Size.0 mm Body Thickness.10 12. Thin Profile Plastic Quad Flat Package (TQFP) DRAWING NO.75 9. Lead coplanarity is 0. 44A REV.15 1. 1.30 0. Dimensions D1 and E1 do not include mold protrusion. Dimensions D1 and E1 are maximum plastic body size dimensions including mold mismatch.00 12. 0.00 12. CA 95131 TITLE 44A.09 0.00 10. E1 B C L e 10/5/2001 2325 Orchard Parkway San Jose.05 12. Variation ACB.20 0. 2.05 0.95 11.

559 1.240 13. Dimensions D and E1 do not include mold Flash or Protrusion.462 0.578 15.070 15.540 TYP MAX 4. 40P6 REV. B R 13 2466HS–AVR–12/03 . CA 95131 TITLE 40P6.381 17.ATmega16(L) 40P6 D PIN 1 E1 A SEATING PLANE L B1 e E B A1 C eB 0º ~ 15º REF SYMBOL A A1 D E E1 B COMMON DIMENSIONS (Unit of Measure = mm) MIN – 0. This package conforms to JEDEC reference MS-011.875 13.651 3. Variation AC. 40-lead (0.356 1.494 NOM – – – – – – – – – – 2.24 mm Wide) Plastic Dual Inline Package (PDIP) DRAWING NO. 2. Mold Flash or Protrusion shall not exceed 0.048 0.203 15.970 0.010"). B1 L C eB e 09/28/01 2325 Orchard Parkway San Jose.600"/15.526 Note 2 Note 2 NOTE Notes: 1.556 0.826 – 52.381 52.041 3.25 mm (0.

18 0.05 NOTE 0.0 mm Body.40 5. 7 x 7 x 1.20 7.20 0.23 7.50 mm Micro Lead Frame Package (MLF) DRAWING NO. 44-pad. JEDEC Standard MO-220.02 0.30 b BOTTOM VIEW e D2 E E2 e 5.35 0.75 01/15/03 2325 Orchard Parkway San Jose.25 REF MAX 1.00 0. CA 95131 TITLE 44M1. 44M1 REV.80 – NOM 0. C R 14 ATmega16(L) 2466HS–AVR–12/03 . Lead Pitch 0.55 0.00 BSC 5. 1 (SAW Singulation) VKKD-1.40 Notes: 1.44M1 D Marked Pin# 1 ID E SEATING PLANE TOP VIEW A1 A3 A L D2 Pin #1 Corner SIDE VIEW COMMON DIMENSIONS (Unit of Measure = mm) E2 SYMBOL A A1 A3 b D MIN 0.00 5. L 0. Fig.00 BSC 0.00 5.50 BSC 5.90 0.

– ATmega16(L) Rev. Problem Fix / Workaround – – If ATmega16 is the only device in the scan chain. Select the Device ID Register of the ATmega16 by issuing the IDCODE instruction or by entering the Test-Logic-Reset state of the TAP controller to read out the contents of its Device ID Register and possibly data from succeeding devices of the scan chain. – ATmega16(L) Rev. Issue the BYPASS instruction to the ATmega16 while reading the Device ID Registers of preceding devices of the boundary scan chain. the ATmega16 must be the fist device in the chain. If the Device IDs of all devices in the boundary scan chain must be captured simultaneously. the ATmega16 must be the fist device in the chain. IDCODE masks data from TDI input The JTAG instruction IDCODE is not working correctly.ATmega16(L) Errata ATmega16(L) Rev. Issue the BYPASS instruction to the ATmega16 while reading the Device ID Registers of preceding devices of the boundary scan chain. Data to succeeding devices are replaced by all-ones during Update-DR. 15 2466HS–AVR–12/03 . H • IDCODE masks data from TDI input 1. the problem is not visible. Select the Device ID Register of the ATmega16 by issuing the IDCODE instruction or by entering the Test-Logic-Reset state of the TAP controller to read out the contents of its Device ID Register and possibly data from succeeding devices of the scan chain. • IDCODE masks data from TDI input 1. the problem is not visible. IDCODE masks data from TDI input The JTAG instruction IDCODE is not working correctly. I The revision letter in this section refers to the revision of the ATmega16 device. Data to succeeding devices are replaced by all-ones during Update-DR. Data to succeeding devices are replaced by all-ones during Update-DR. the problem is not visible. Select the Device ID Register of the ATmega16 by issuing the IDCODE instruction or by entering the Test-Logic-Reset state of the TAP controller to read out the contents of its Device ID Register and possibly data from succeeding devices of the scan chain. Problem Fix / Workaround – – If ATmega16 is the only device in the scan chain. Issue the BYPASS instruction to the ATmega16 while reading the Device ID Registers of preceding devices of the boundary scan chain. IDCODE masks data from TDI input The JTAG instruction IDCODE is not working correctly. If the Device IDs of all devices in the boundary scan chain must be captured simultaneously. Problem Fix / Workaround – – If ATmega16 is the only device in the scan chain. G • IDCODE masks data from TDI input 1.

16 ATmega16(L) 2466HS–AVR–12/03 . the ATmega16 must be the fist device in the chain.– If the Device IDs of all devices in the boundary scan chain must be captured simultaneously.

17 2466HS–AVR–12/03 . 14. Fixed typo for 16 MHz MLF package in “Ordering Information” on page 11. 13. Added a note regarding JTAGEN fuse to Table 105 on page 259. Added Chip Erase as a first step in “Programming the Flash” on page 286 and “Programming the EEPROM” on page 287. Updated Absolute Maximum Ratings* and DC Characteristics in “Electrical Characteristics” on page 289. 3. 4. Added a proposal for solving problems regarding the JTAG instruction IDCODE in “Errata” on page 15. Updated “JTAG Interface and On-chip Debug System” on page 34. Changes from Rev. Changed ICP to ICP1 in the datasheet. 2466G-10/03 to Rev. 1. Updated “Calibrated Internal RC Oscillator” on page 27. 6. Updated Table 15 on page 36. All page numbers refer to this document. 7. 1. Removed “Preliminary” from the datasheet. 2466E-10/02 to Rev. Added the section “Unconnected pins” on page 53. Added note about masking out unused bits when reading the Program Counter in “Stack Pointer” on page 10. 10. 1. 8. Updated Figure 46 on page 101. 5. 12. 11. 2. 2. 2466F-02/03 to Rev. Added note 2 to Figure 126 on page 251. Updated “Test Access Port – TAP” on page 220 regarding JTAGEN. 2466G-10/03 This section contains a log on the changes made to the datasheet for ATmega16. Updated assembly and C code examples in “Watchdog Timer Control Register – WDTCR” on page 41. Updated “ATmega16 Typical Characteristics” on page 297. Updated description for the JTD bit on page 229. Table 82 on page 215 and Table 115 on page 274.ATmega16(L) Datasheet Change Log for ATmega16 Changes from Rev. 9. 2466H-12/03 Changes from Rev. 2466F-02/03 All page numbers refer to this document. All page numbers refer to this document. 3.

“TWI Bit Rate Prescaler. 12. Added updated “Packaging Information” on page 12. Changed all Flash write/erase cycles from 1. 5. 1. Updated “Errata” on page 15.000 to 10. Table 119 on page 291. Table 59 on page 141. Table 15 on page 36. Added note about Differential Mode with Auto Triggering in “Prescaling and Conversion Timing” on page 205. Table 1 on page 18. Added section “EEPROM Write During Power-down Sleep Mode” on page 20. Table 102 on page 257. Note added in “External Clock” on page 29. 1. 2466E-10/02 Changes from Rev. Added Table 73. 2466C-03/02 18 All page numbers refer to this document. Table 67 on page 165. 14. Added note about frequency variation when using an external clock. Table 46 on page 110. 6. Removed reference to the “Multi-purpose Oscillator” application note and “32 kHz Crystal Oscillator” application note. which do not exist. Added information about PWM symmetry for Timer0 and Timer2. An extra row and a note added in Table 118 on page 291.000. 2466D-09/02 All page numbers refer to this document. 15.” on page 180 to describe the TWPS bits in the “TWI Status Register – TWSR” on page 179. Table 90 on page 233. Updated “DC Characteristics” on page 289. Added “Power Consumption” data in “Features” on page 1. 1. Changes from Rev. Removed ADHSM completely. Added tips on how to disable the OCD system in “On-chip Debug System” on page 34. Table 42 on page 83. 13. 10. 7. All page numbers refer to this document. 9. Added note in “Filling the Temporary Buffer (Page Loading)” on page 252 about writing to the EEPROM during an SPM Page Load. Updated the following tables: Table 4 on page 24.4. 2. 3. 2466B-09/01 to Rev. 8. Table 45 on page 110. 11. 2466D-09/02 to Rev. ATmega16(L) 2466HS–AVR–12/03 . 16. Updated typical EEPROM programming time. and Table 122 on page 295. Added section “Default Clock Source” on page 23. Table 121 on page 293. 2466C-03/02 to Rev. Various minor TWI corrections. “DC Characteristics” on page 289. Changes from Rev.

Table 121 on page 293. 14. Table 6 on page 26. Table 8 on page 27. “Scan Signals for the Oscillators(1)(2)(3). See “Leaving Programming Mode” on page 286. Corrected ordering code for MLF package (16MHz) in “Ordering Information” on page 11. 12. Added not regarding OCDEN Fuse below Table 105 on page 259. Improved description on how to do a polarity check of the ADC doff results in “ADC Conversion Result” on page 214. Removed alternative algortihm for leaving JTAG Programming mode. Table 9 on page 27. Corrected Table 90. and Table 122 on page 295. 7. Updated Table 17 on page 41 with typical WDT Time-out.” on page 233. 8.ATmega16(L) 2. Added Calibrated RC Oscillator characterization curves in section “ATmega16 Typical Characteristics” on page 297. 13. Added JTAG version number for rev. Added the note at the end of the “Bit Rate Generator Unit” on page 176. and Table 10 on page 28. 9. 6. Table 5 on page 25. Updated Programming Figures: Figure 127 on page 261 and Figure 136 on page 272 are updated to also reflect that AVCC must be connected during Programming mode. Corrected description of ADSC bit in “ADC Control and Status Register A – ADCSRA” on page 217. H in Table 87 on page 227. 5. Removed some of the TBD's in the following tables and pages: Table 15 on page 36. Table 116 on page 272 (table removed in document review #D). 15. Figure 131 on page 268 added to illustrate how to program the fuses. 11. Table 119 on page 291. Table 16 on page 40. Updated typical start-up time in the following tables: Table 3 on page 23. 10. Added a note regarding usage of the “PROG_PAGELOAD ($6)” on page 278 and “PROG_PAGEREAD ($7)” on page 278. 19 2466HS–AVR–12/03 . 4. “Electrical Characteristics” on page 289. 3. Added Some Preliminary Test Limits and Characterization Data. Updated TWI Chapter.

expressly or by implication. Blvd. and AVR Studio ® are the registered trademarks of Atmel Corporation or its subsidiaries. CA 95131. CA 95131. Microsoft ®. and does not make any commitment to update the information contained herein. © Atmel Corporation 2003. reserves the right to change devices or specifications detailed herein at any time without notice. USA Tel: 1(719) 576-3300 Fax: 1(719) 540-1759 Scottish Enterprise Technology Park Maxwell Building East Kilbride G75 0QR. USA Tel: 1(719) 576-3300 Fax: 1(719) 540-1759 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 Microcontrollers 2325 Orchard Parkway San Jose. Colorado Springs.Atmel Corporation 2325 Orchard Parkway San Jose. USA Tel: 1(408) 441-0311 Fax: 1(408) 436-4314 RF/Automotive Theresienstrasse 2 Postfach 3535 74025 Heilbronn. France Tel: (33) 4-76-58-30-00 Fax: (33) 4-76-58-34-80 Asia Room 1219 Chinachem Golden Plaza 77 Mody Road Tsimshatsui East Kowloon Hong Kong Tel: (852) 2721-9778 Fax: (852) 2722-1369 ASIC/ASSP/Smart Cards Zone Industrielle 13106 Rousset Cedex. No licenses to patents or other intellectual property of Atmel are granted by the Company in connection with the sale of Atmel products. France Tel: (33) 4-42-53-60-00 Fax: (33) 4-42-53-60-01 1150 East Cheyenne Mtn. CO 80906. Tokyo 104-0033 Japan Tel: (81) 3-3523-3551 Fax: (81) 3-3523-7581 Literature Requests www.atmel. France Tel: (33) 2-40-18-18-18 Fax: (33) 2-40-18-19-60 Biometrics/Imaging/Hi-Rel MPU/ High Speed Converters/RF Datacom Avenue de Rochepleine BP 123 38521 Saint-Egreve Cedex. Blvd. USA Tel: 1(408) 441-0311 Fax: 1(408) 487-2600 Atmel Operations Memory 2325 Orchard Parkway San Jose. Colorado Springs. Windows NT®. Other terms and product names may be the trademarks of others Printed on recycled paper. USA Tel: 1(408) 441-0311 Fax: 1(408) 436-4314 La Chantrerie BP 70602 44306 Nantes Cedex 3. Tonetsu Shinkawa Bldg. 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. 1-24-8 Shinkawa Chuo-ku. 2466HS–AVR–12/03 . Germany Tel: (49) 71-31-67-0 Fax: (49) 71-31-67-2340 1150 East Cheyenne Mtn. Windows®. The Company assumes no responsibility for any errors which may appear in this document. and Windows XP ® are the registered trademarks of Microsoft Corporation. CO 80906. Scotland Tel: (44) 1355-803-000 Fax: (44) 1355-242-743 Japan 9F. AVR®.com/literature Disclaimer: Atmel Corporation makes no warranty for the use of its products. Atmel’s products are not authorized for use as critical components in life support devices or systems. Atmel ® and combinations thereof. All rights reserved. CA 95131.

.This datasheet has been download from: www.datasheetcatalog.com Datasheets for electronics components.

Sign up to vote on this title
UsefulNot useful