- No category
advertisement
ATmega8(L)
System Control and Reset
Resetting the AVR
Reset Sources
During Reset, all I/O Registers are set to their initial values, and the program starts execution from the Reset Vector. If the program never enables an interrupt source, the Interrupt Vectors are not used, and regular program code can be placed at these locations. This is also the case if the Reset Vector is in the Application section while the Interrupt Vectors are in the boot section or vice versa. The circuit diagram in
shows the Reset Logic.
Table 15 on page 38 defines the electrical parameters of the reset circuitry.
The I/O ports of the AVR are immediately reset to their initial state when a reset source goes active. This does not require any clock source to be running.
After all reset sources have gone inactive, a delay counter is invoked, stretching the internal reset. This allows the power to reach a stable level before normal operation starts. The time-out period of the delay counter is defined by the user through the CKSEL Fuses. The different selec-
tions for the delay period are presented in “Clock Sources” on page 26
.
The ATmega8 has four sources of Reset:
• Power-on Reset. The MCU is reset when the supply voltage is below the Power-on Reset threshold (V
POT
)
• External Reset. The MCU is reset when a low level is present on the RESET pin for longer than the minimum pulse length
• Watchdog Reset. The MCU is reset when the Watchdog Timer period expires and the
Watchdog is enabled
• Brown-out Reset. The MCU is reset when the supply voltage V
CC
is below the Brown-out
Reset threshold (V
BOT
) and the Brown-out Detector is enabled
37
2486Z–AVR–02/11
Figure 14. Reset Logic
DATA BUS
MCU Control and Status
Register (MCUCSR)
BODEN
BODLEVEL
Pull-up Resistor
Brown-Out
Reset Circuit
SPIKE
FILTER
38
Watchdog
Oscillator
Clock
Generator
CKSEL[3:0]
SUT[1:0]
CK
Delay Counters
TIMEOUT
Table 15. Reset Characteristics
Symbol Parameter
Power-on Reset Threshold
V
POT
Power-on Reset Threshold
Voltage (falling)
V
RST
RESET Pin Threshold Voltage t
RST
Minimum pulse width on
RESET Pin
Condition Min
0.2
Typ
1.4
1.3
Max
2.3
2.3
0.9
1.5
Units
V
V
CC
µs
V t
BOT
BOD
Brown-out Reset Threshold
Minimum low voltage period for
Brown-out Detection
BODLEVEL = 1 2.4
BODLEVEL = 0 3.7
BODLEVEL = 1
BODLEVEL = 0
2.6
4.0
2
2
2.9
4.5
V
µs
V
HYST
Brown-out Detector hysteresis 130 mV
Notes: 1. The Power-on Reset will not work unless the supply voltage has been below V
POT
(falling)
2. V
BOT
may be below nominal minimum operating voltage for some devices. For devices where this is the case, the device is tested down to V
CC
= V
BOT
during the production test. This guarantees that a Brown-out Reset will occur before V
CC
drops to a voltage where correct operation of the microcontroller is no longer guaranteed. The test is performed using
BODLEVEL = 1 for ATmega8L and BODLEVEL = 0 for ATmega8. BODLEVEL = 1 is not applicable for ATmega8
ATmega8(L)
2486Z–AVR–02/11
Power-on Reset
ATmega8(L)
A Power-on Reset (POR) pulse is generated by an On-chip detection circuit. The detection level
is defined in Table 15 on page 38
. The POR is activated whenever V
CC
is below the detection level. The POR circuit can be used to trigger the Start-up Reset, as well as to detect a failure in supply voltage.
A Power-on Reset (POR) circuit ensures that the device is reset from Power-on. Reaching the
Power-on Reset threshold voltage invokes the delay counter, which determines how long the device is kept in RESET after V
CC
rise. The RESET signal is activated again, without any delay, when V
CC
decreases below the detection level.
Figure 15. MCU Start-up, RESET Tied to V
CC
V
POT
V
CC
V
RST
RESET
TIME-OUT t
TOUT
INTERNAL
RESET
Figure 16. MCU Start-up, RESET Extended Externally
V
POT
V
CC
V
RST
RESET t
TOUT
TIME-OUT
INTERNAL
RESET
39
2486Z–AVR–02/11
External Reset
An External Reset is generated by a low level on the RESET pin. Reset pulses longer than the minimum pulse width (see
Table 15 on page 38 ) will generate a reset, even if the clock is not
running. Shorter pulses are not guaranteed to generate a reset. When the applied signal reaches the Reset Threshold Voltage – V
RST
on its positive edge, the delay counter starts the
MCU after the time-out period t
TOUT
has expired.
Figure 17. External Reset During Operation
CC
Brown-out Detection
ATmega8 has an On-chip Brown-out Detection (BOD) circuit for monitoring the V
CC
level during operation by comparing it to a fixed trigger level. The trigger level for the BOD can be selected by the fuse BODLEVEL to be 2.7V (BODLEVEL unprogrammed), or 4.0V (BODLEVEL programmed). The trigger level has a hysteresis to ensure spike free Brown-out Detection. The hysteresis on the detection level should be interpreted as
V
BOT+
= V
BOT
+ V
HYST
/2 and V
BOT-
= V
BOT
- V
HYST
/2.
The BOD circuit can be enabled/disabled by the fuse BODEN. When the BOD is enabled
(BODEN programmed), and V
CC
decreases to a value below the trigger level (V
BOT-
in
), the Brown-out Reset is immediately activated. When V
CC
increases above the trigger level
(V
BOT+
in expired.
), the delay counter starts the MCU after the time-out period t
TOUT
has
The BOD circuit will only detect a drop in V
CC
if the voltage stays below the trigger level for longer than t
BOD
given in
.
Figure 18. Brown-out Reset During Operation
V
CC
V
BOT-
V
BOT+
RESET t
TOUT TIME-OUT
INTERNAL
RESET
40
ATmega8(L)
2486Z–AVR–02/11
Watchdog Reset
ATmega8(L)
When the Watchdog times out, it will generate a short reset pulse of 1 CK cycle duration. On the falling edge of this pulse, the delay timer starts counting the time-out period t
TOUT
for details on operation of the Watchdog Timer.
. Refer to
Figure 19. Watchdog Reset During Operation
CC
CK
MCU Control and
Status Register –
MCUCSR
The MCU Control and Status Register provides information on which reset source caused an
MCU Reset.
Bit
Read/Write
Initial Value
R
0
7
–
R
0
6
–
R
0
5
–
R
0
4
–
3
WDRF
R/W
2
BORF
1
EXTRF
R/W R/W
See Bit Description
0
PORF
R/W
MCUCSR
• Bit 7..4 – Res: Reserved Bits
These bits are reserved bits in the ATmega8 and always read as zero.
• Bit 3 – WDRF: Watchdog Reset Flag
This bit is set if a Watchdog Reset occurs. The bit is reset by a Power-on Reset, or by writing a logic zero to the flag.
• Bit 2 – BORF: Brown-out Reset Flag
This bit is set if a Brown-out Reset occurs. The bit is reset by a Power-on Reset, or by writing a logic zero to the flag.
• Bit 1 – EXTRF: External Reset Flag
This bit is set if an External Reset occurs. The bit is reset by a Power-on Reset, or by writing a logic zero to the flag.
• Bit 0 – PORF: Power-on Reset Flag
This bit is set if a Power-on Reset occurs. The bit is reset only by writing a logic zero to the flag.
To make use of the Reset Flags to identify a reset condition, the user should read and then reset the MCUCSR as early as possible in the program. If the register is cleared before another reset occurs, the source of the reset can be found by examining the Reset Flags.
41
2486Z–AVR–02/11
Internal Voltage
Reference
Voltage Reference
Enable Signals and
Start-up Time
ATmega8 features an internal bandgap reference. This reference is used for Brown-out Detection, and it can be used as an input to the Analog Comparator or the ADC. The 2.56V reference to the ADC is generated from the internal bandgap reference.
The voltage reference has a start-up time that may influence the way it should be used. The start-up time is given in
Table 16 . To save power, the reference is not always turned on. The ref-
erence is on during the following situations:
1.
When the BOD is enabled (by programming the BODEN Fuse)
2.
When the bandgap reference is connected to the Analog Comparator (by setting the
ACBG bit in ACSR)
3.
When the ADC is enabled
Thus, when the BOD is not enabled, after setting the ACBG bit or enabling the ADC, the user must always allow the reference to start up before the output from the Analog Comparator or
ADC is used. To reduce power consumption in Power-down mode, the user can avoid the three conditions above to ensure that the reference is turned off before entering Power-down mode.
Table 16. Internal Voltage Reference Characteristics
Symbol Parameter
V
BG t
BG
I
BG
Bandgap reference voltage
Bandgap reference start-up time
Bandgap reference current consumption
Min
1.15
Typ
1.30
40
10
Max
1.40
70
Units
V
µs
µA
42
ATmega8(L)
2486Z–AVR–02/11
ATmega8(L)
Watchdog Timer
The Watchdog Timer is clocked from a separate On-chip Oscillator which runs at 1MHz. This is the typical value at V
CC
= 5V. See characterization data for typical values at other V
CC
levels. By controlling the Watchdog Timer prescaler, the Watchdog Reset interval can be adjusted as
. The WDR – Watchdog Reset – instruction resets the Watchdog
Timer. The Watchdog Timer is also reset when it is disabled and when a Chip Reset occurs.
Eight different clock cycle periods can be selected to determine the reset period. If the reset period expires without another Watchdog Reset, the ATmega8 resets and executes from the
Reset Vector. For timing details on the Watchdog Reset, refer to page 41 .
To prevent unintentional disabling of the Watchdog, a special turn-off sequence must be followed when the Watchdog is disabled. Refer to
“Watchdog Timer Control Register – WDTCR”
for details.
Figure 20. Watchdog Timer
WATCHDOG
OSCILLATOR
Watchdog Timer
Control Register –
WDTCR
Bit
Read/Write
Initial Value
R
0
7
–
R
0
6
–
R
0
5
–
4
WDCE
R/W
0
3
WDE
R/W
0
2
WDP2
R/W
0
1
WDP1
R/W
0
0
WDP0
R/W
0
WDTCR
• Bits 7..5 – Res: Reserved Bits
These bits are reserved bits in the ATmega8 and will always read as zero.
• Bit 4 – WDCE: Watchdog Change Enable
This bit must be set when the WDE bit is written to logic zero. Otherwise, the Watchdog will not be disabled. Once written to one, hardware will clear this bit after four clock cycles. Refer to
3 – WDE: Watchdog Enable” on page 44
for a Watchdog disable procedure. In Safety Level 1 and 2, this bit must also be set when changing the prescaler bits. See the Code Examples on
43
2486Z–AVR–02/11
• Bit 3 – WDE: Watchdog Enable
When the WDE is written to logic one, the Watchdog Timer is enabled, and if the WDE is written to logic zero, the Watchdog Timer function is disabled. WDE can only be cleared if the WDCE bit has logic level one. To disable an enabled Watchdog Timer, the following procedure must be followed:
1.
In the same operation, write a logic one to WDCE and WDE. A logic one must be written to WDE even though it is set to one before the disable operation starts
2.
Within the next four clock cycles, write a logic 0 to WDE. This disables the Watchdog
• Bits 2..0 – WDP2, WDP1, WDP0: Watchdog Timer Prescaler 2, 1, and 0
The WDP2, WDP1, and WDP0 bits determine the Watchdog Timer prescaling when the Watchdog Timer is enabled. The different prescaling values and their corresponding Timeout Periods are shown in
.
Table 17. Watchdog Timer Prescale Select
WDP2 WDP1 WDP0
0
0
0
0
0
1
1
1
0
0
1
1
1
1
0
0
1
1
0
1
0
1
0
1
Number of WDT
Oscillator Cycles
16K (16,384)
32K (32,768)
64K (65,536)
128K (131,072)
256K (262,144)
512K (524,288)
1,024K (1,048,576)
2,048K (2,097,152)
Typical Time-out at V
CC
= 3.0V
17.1ms
34.3ms
68.5ms
0.14s
0.27s
0.55s
1.1s
2.2s
Typical Time-out at V
CC
= 5.0V
16.3ms
32.5ms
65ms
0.13s
0.26s
0.52s
1.0s
2.1s
The following code example shows one assembly and one C function for turning off the WDT.
The example assumes that interrupts are controlled (for example, by disabling interrupts globally) so that no interrupts will occur during execution of these functions.
44
ATmega8(L)
2486Z–AVR–02/11
ATmega8(L)
Timed Sequences for Changing the
Configuration of the Watchdog
Timer
The sequence for changing the Watchdog Timer configuration differs slightly between the safety levels. Separate procedures are described for each level.
Assembly Code Example
WDT_off:
; reset WDT
WDR
; Write logical one to WDCE and WDE
in
r16, WDTCR
ori
r16, (1<<WDCE)|(1<<WDE)
out
WDTCR, r16
; Turn off WDT
ldi
r16, (0<<WDE)
out
WDTCR, r16
ret
C Code Example
void
WDT_off(void)
{
/* reset WDT */
_WDR();
/* Write logical one to WDCE and WDE */
WDTCR |= (1<<WDCE) | (1<<WDE);
/* Turn off WDT */
WDTCR = 0x00;
}
Safety Level 1
(WDTON Fuse
Unprogrammed)
Safety Level 2
(WDTON Fuse
Programmed)
In this mode, the Watchdog Timer is initially disabled, but can be enabled by writing the WDE bit to 1 without any restriction. A timed sequence is needed when changing the Watchdog Time-out period or disabling an enabled Watchdog Timer. To disable an enabled Watchdog Timer and/or changing the Watchdog Time-out, the following procedure must be followed:
1.
In the same operation, write a logic one to WDCE and WDE. A logic one must be written to WDE regardless of the previous value of the WDE bit
2.
Within the next four clock cycles, in the same operation, write the WDE and WDP bits as desired, but with the WDCE bit cleared
In this mode, the Watchdog Timer is always enabled, and the WDE bit will always read as one. A timed sequence is needed when changing the Watchdog Time-out period. To change the
Watchdog Time-out, the following procedure must be followed:
1.
In the same operation, write a logical one to WDCE and WDE. Even though the WDE always is set, the WDE must be written to one to start the timed sequence
Within the next four clock cycles, in the same operation, write the WDP bits as desired, but with the WDCE bit cleared. The value written to the WDE bit is irrelevant.
45
2486Z–AVR–02/11
advertisement
Related manuals
advertisement
Table of contents
- 1 Features
- 2 Pin Configurations
- 3 Overview
- 3 Block Diagram
- 4 Disclaimer
- 5 Pin Descriptions
- 5 VCC
- 5 GND
- 5 Port B (PB7..PB0) XTAL1/XTAL2/TOSC1/ TOSC2
- 5 Port C (PC5..PC0)
- 5 PC6/RESET
- 5 Port D (PD7..PD0)
- 5 RESET
- 6 AVCC
- 6 AREF
- 6 ADC7..6 (TQFP and QFN/MLF Package Only)
- 7 Resources
- 7 Data Retention
- 8 About Code Examples
- 9 Atmel AVR CPU Core
- 9 Introduction
- 9 Architectural Overview
- 11 Arithmetic Logic Unit – ALU
- 11 Status Register
- 12 General Purpose Register File
- 13 The X-register, Y- register and Z-register
- 13 Stack Pointer
- 13 Instruction Execution Timing
- 14 Reset and Interrupt Handling
- 16 Interrupt Response Time
- 17 AVR ATmega8 Memories
- 17 In-System Reprogrammable Flash Program Memory
- 18 SRAM Data Memory
- 19 Data Memory Access Times
- 19 EEPROM Data Memory
- 19 EEPROM Read/Write Access
- 20 The EEPROM Address Register – EEARH and EEARL
- 20 The EEPROM Data Register – EEDR
- 20 The EEPROM Control Register – EECR
- 23 EEPROM Write during Power-down Sleep Mode
- 23 Preventing EEPROM Corruption
- 24 I/O Memory
- 25 System Clock and Clock Options
- 25 Clock Systems and their Distribution
- 25 CPU Clock – clkCPU
- 25 I/O Clock – clkI/O
- 25 Flash Clock – clkFLASH
- 26 Asynchronous Timer Clock – clkASY
- 26 ADC Clock – clkADC
- 26 Clock Sources
- 27 Crystal Oscillator
- 28 Low-frequency Crystal Oscillator
- 28 External RC Oscillator
- 30 Calibrated Internal RC Oscillator
- 31 Oscillator Calibration Register – OSCCAL
- 32 External Clock
- 32 Timer/Counter Oscillator
- 33 Power Management and Sleep Modes
- 33 MCU Control Register – MCUCR
- 34 Idle Mode
- 34 ADC Noise Reduction Mode
- 34 Power-down Mode
- 34 Power-save Mode
- 35 Standby Mode
- 35 Minimizing Power Consumption
- 35 Analog-to-Digital Converter (ADC)
- 35 Analog Comparator
- 36 Brown-out Detector
- 36 Internal Voltage Reference
- 36 Watchdog Timer
- 36 Port Pins
- 37 System Control and Reset
- 37 Resetting the AVR
- 37 Reset Sources
- 39 Power-on Reset
- 40 External Reset
- 40 Brown-out Detection
- 41 Watchdog Reset
- 41 MCU Control and Status Register – MCUCSR
- 42 Internal Voltage Reference
- 42 Voltage Reference Enable Signals and Start-up Time
- 43 Watchdog Timer
- 43 Watchdog Timer Control Register – WDTCR
- 45 Timed Sequences for Changing the Configuration of the Watchdog Timer
- 45 Safety Level 1 (WDTON Fuse Unprogrammed)
- 45 Safety Level 2 (WDTON Fuse Programmed)
- 46 Interrupts
- 46 Interrupt Vectors in ATmega8
- 49 Moving Interrupts Between Application and Boot Space
- 49 General Interrupt Control Register – GICR
- 51 I/O Ports
- 51 Introduction
- 52 Ports as General Digital I/O
- 52 Configuring the Pin
- 53 Reading the Pin Value
- 55 Digital Input Enable and Sleep Modes
- 56 Unconnected pins
- 56 Alternate Port Functions
- 58 Special Function IO Register – SFIOR
- 58 Alternate Functions of Port B
- 61 Alternate Functions of Port C
- 63 Alternate Functions of Port D
- 65 Register Description for I/O Ports
- 65 The Port B Data Register – PORTB
- 65 The Port B Data Direction Register – DDRB
- 65 The Port B Input Pins Address – PINB
- 65 The Port C Data Register – PORTC
- 65 The Port C Data Direction Register – DDRC
- 65 The Port C Input Pins Address – PINC
- 65 The Port D Data Register – PORTD
- 65 The Port D Data Direction Register – DDRD
- 65 The Port D Input Pins Address – PIND
- 66 External Interrupts
- 66 MCU Control Register – MCUCR
- 67 General Interrupt Control Register – GICR
- 67 General Interrupt Flag Register – GIFR
- 69 8-bit Timer/Counter0
- 69 Overview
- 69 Registers
- 69 Definitions
- 70 Timer/Counter Clock Sources
- 70 Counter Unit
- 70 Operation
- 70 Timer/Counter Timing Diagrams
- 71 8-bit Timer/Counter Register Description
- 71 Timer/Counter Control Register – TCCR0
- 72 Timer/Counter Register – TCNT0
- 72 Timer/Counter Interrupt Mask Register – TIMSK
- 72 Timer/Counter Interrupt Flag Register – TIFR
- 73 Timer/Counter0 and Timer/Counter1 Prescalers
- 73 Internal Clock Source
- 73 Prescaler Reset
- 73 External Clock Source
- 74 Special Function IO Register – SFIOR
- 75 16-bit Timer/Counter1
- 75 Overview
- 76 Registers
- 77 Definitions
- 77 Compatibility
- 77 Accessing 16-bit Registers
- 80 Reusing the Temporary High Byte Register
- 80 Timer/Counter Clock Sources
- 80 Counter Unit
- 81 Input Capture Unit
- 82 Input Capture Pin Source
- 83 Noise Canceler
- 83 Using the Input Capture Unit
- 83 Output Compare Units
- 85 Force Output Compare
- 85 Compare Match Blocking by TCNT1 Write
- 85 Using the Output Compare Unit
- 85 Compare Match Output Unit
- 87 Compare Output Mode and Waveform Generation
- 87 Modes of Operation
- 87 Normal Mode
- 87 Clear Timer on Compare Match (CTC) Mode
- 88 Fast PWM Mode
- 90 Phase Correct PWM Mode
- 92 Phase and Frequency Correct PWM Mode
- 94 Timer/Counter Timing Diagrams
- 96 16-bit Timer/Counter Register Description
- 96 Timer/Counter 1 Control Register A – TCCR1A
- 98 Timer/Counter 1 Control Register B – TCCR1B
- 99 Timer/Counter 1 – TCNT1H and TCNT1L
- 99 Output Compare Register 1 A – OCR1AH and OCR1AL
- 99 Output Compare Register 1 B – OCR1BH and OCR1BL
- 100 Input Capture Register 1 – ICR1H and ICR1L
- 100 Timer/Counter Interrupt Mask Register – TIMSK(1)
- 101 Timer/Counter Interrupt Flag Register – TIFR(1)
- 102 8-bit Timer/Counter2 with PWM and Asynchronous Operation
- 102 Overview
- 103 Registers
- 103 Definitions
- 103 Timer/Counter Clock Sources
- 104 Counter Unit
- 105 Output Compare Unit
- 106 Force Output Compare
- 106 Compare Match Blocking by TCNT2 Write
- 106 Using the Output Compare Unit
- 107 Compare Match Output Unit
- 108 Compare Output Mode and Waveform Generation
- 108 Modes of Operation
- 108 Normal Mode
- 109 Clear Timer on Compare Match (CTC) Mode
- 110 Fast PWM Mode
- 111 Phase Correct PWM Mode
- 112 Timer/Counter Timing Diagrams
- 114 8-bit Timer/Counter Register Description
- 114 Timer/Counter Control Register – TCCR2
- 116 Timer/Counter Register – TCNT2
- 116 Output Compare Register – OCR2
- 117 Asynchronous Operation of the Timer/Counter
- 117 Asynchronous Status Register – ASSR
- 117 Asynchronous Operation of Timer/Counter2
- 119 Timer/Counter Interrupt Mask Register – TIMSK
- 119 Timer/Counter Interrupt Flag Register – TIFR
- 120 Timer/Counter Prescaler
- 120 Special Function IO Register – SFIOR
- 121 Serial Peripheral Interface – SPI
- 125 SS Pin Functionality
- 125 Slave Mode
- 125 Master Mode
- 125 SPI Control Register – SPCR
- 126 SPI Status Register – SPSR
- 127 SPI Data Register – SPDR
- 127 Data Modes
- 129 USART
- 129 Overview
- 130 AVR USART vs. AVR UART – Compatibility
- 130 Clock Generation
- 131 Internal Clock Generation – The Baud Rate Generator
- 132 Double Speed Operation (U2X)
- 132 External Clock
- 132 Synchronous Clock Operation
- 133 Frame Formats
- 134 Parity Bit Calculation
- 134 USART Initialization
- 136 Data Transmission – The USART Transmitter
- 136 Sending Frames with 5 to 8 Data Bits
- 137 Sending Frames with 9 Data Bits
- 137 Transmitter Flags and Interrupts
- 138 Parity Generator
- 138 Disabling the Transmitter
- 138 Data Reception – The USART Receiver
- 138 Receiving Frames with 5 to 8 Data Bits
- 139 Receiving Frames with 9 Data Bits
- 141 Receive Compete Flag and Interrupt
- 141 Receiver Error Flags
- 141 Parity Checker
- 142 Disabling the Receiver
- 142 Flushing the Receive Buffer
- 142 Asynchronous Data Reception
- 142 Asynchronous Clock Recovery
- 143 Asynchronous Data Recovery
- 144 Asynchronous Operational Range
- 145 Multi-processor Communication Mode
- 145 Using MPCM
- 146 Accessing UBRRH/UCSRC Registers
- 146 Write Access
- 147 Read Access
- 148 USART Register Description
- 148 USART I/O Data Register – UDR
- 148 USART Control and Status Register A – UCSRA
- 149 USART Control and Status Register B – UCSRB
- 150 USART Control and Status Register C – UCSRC
- 152 USART Baud Rate Registers – UBRRL and UBRRHs
- 153 Examples of Baud Rate Setting
- 157 Two-wire Serial Interface
- 157 Features
- 157 Two-wire Serial Interface Bus Definition
- 157 TWI Terminology
- 158 Electrical Interconnection
- 158 Data Transfer and Frame Format
- 158 Transferring Bits
- 158 START and STOP Conditions
- 159 Address Packet Format
- 160 Data Packet Format
- 160 Combining Address and Data Packets into a Transmission
- 161 Multi-master Bus Systems, Arbitration and Synchronization
- 163 Overview of the TWI Module
- 163 SCL and SDA Pins
- 164 Bit Rate Generator Unit
- 164 Bus Interface Unit
- 164 Address Match Unit
- 164 Control Unit
- 165 TWI Register Description
- 165 TWI Bit Rate Register – TWBR
- 165 TWI Control Register – TWCR
- 166 TWI Status Register – TWSR
- 167 TWI Data Register – TWDR
- 167 TWI (Slave) Address Register – TWAR
- 168 Using the TWI
- 171 Transmission Modes
- 171 Master Transmitter Mode
- 175 Master Receiver Mode
- 177 Slave Receiver Mode
- 181 Slave Transmitter Mode
- 183 Miscellaneous States
- 184 Combining Several TWI Modes
- 184 Multi-master Systems and Arbitration
- 186 Analog Comparator
- 186 Special Function IO Register – SFIOR
- 186 Analog Comparator Control and Status Register – ACSR
- 188 Analog Comparator Multiplexed Input
- 189 Analog-to- Digital Converter
- 189 Features
- 191 Starting a Conversion
- 191 Prescaling and Conversion Timing
- 194 Changing Channel or Reference Selection
- 194 ADC Input Channels
- 194 ADC Voltage Reference
- 195 ADC Noise Canceler
- 195 Analog Input Circuitry
- 196 Analog Noise Canceling Techniques
- 196 ADC Accuracy Definitions
- 199 ADC Conversion Result
- 199 ADC Multiplexer Selection Register – ADMUX
- 200 ADC Control and Status Register A – ADCSRA
- 201 The ADC Data Register – ADCL and ADCH
- 202 Boot Loader Support – Read- While-Write Self- Programming
- 202 Boot Loader Features
- 202 Application and Boot Loader Flash Sections
- 202 Application Section
- 202 BLS – Boot Loader Section
- 202 Read-While-Write and No Read- While-Write Flash Sections
- 203 RWW – Read-While- Write Section
- 203 NRWW – No Read- While-Write Section
- 204 Boot Loader Lock Bits
- 205 Entering the Boot Loader Program
- 206 Store Program Memory Control Register – SPMCR
- 207 Addressing the Flash During Self- Programming
- 208 Self-Programming the Flash
- 209 Performing Page Erase by SPM
- 209 Filling the Temporary Buffer (Page Loading)
- 209 Performing a Page Write
- 209 Using the SPM Interrupt
- 209 Consideration While Updating BLS
- 209 Prevent Reading the RWW Section During Self-Programming
- 209 Setting the Boot Loader Lock Bits by SPM
- 210 EEPROM Write Prevents Writing to SPMCR
- 210 Reading the Fuse and Lock Bits from Software
- 210 Preventing Flash Corruption
- 211 Programming Time for Flash when using SPM
- 212 Simple Assembly Code Example for a Boot Loader
- 213 ATmega8 Boot Loader Parameters
- 215 Memory Programming
- 215 Program And Data Memory Lock Bits
- 216 Fuse Bits
- 217 Latching of Fuses
- 218 Signature Bytes
- 218 Calibration Byte
- 218 Page Size
- 219 Parallel Programming Parameters, Pin Mapping, and Commands
- 219 Signal Names
- 221 Parallel Programming
- 221 Enter Programming Mode
- 221 Considerations for Efficient Programming
- 221 Chip Erase
- 222 Programming the Flash
- 224 Programming the EEPROM
- 225 Reading the Flash
- 225 Reading the EEPROM
- 225 Programming the Fuse Low Bits
- 226 Programming the Fuse High Bits
- 226 Programming the Lock Bits
- 226 Reading the Fuse and Lock Bits
- 227 Reading the Signature Bytes
- 227 Reading the Calibration Byte
- 227 Parallel Programming Characteristics
- 230 Serial Downloading
- 230 Serial Programming Pin Mapping
- 231 Serial Programming Algorithm
- 231 Data Polling Flash
- 232 Data Polling EEPROM
- 234 SPI Serial Programming Characteristics
- 235 Electrical Characteristics
- 235 Absolute Maximum Ratings*
- 235 DC Characteristics
- 237 External Clock Drive Waveforms
- 237 External Clock Drive
- 238 Two-wire Serial Interface Characteristics
- 239 SPI Timing Characteristics
- 241 ADC Characteristics
- 242 ATmega8 Typical Characteristics
- 242 Active Supply Current
- 246 Idle Supply Current
- 249 Power-down Supply Current
- 250 Power-save Supply Current
- 251 Standby Supply Current
- 255 Pin Pull-up
- 257 Pin Driver Strength
- 261 Pin Thresholds and Hysteresis
- 265 Bod Thresholds and Analog Comparator Offset
- 268 Internal Oscillator Speed
- 274 Current Consumption of Peripheral Units
- 278 Current Consumption in Reset and Reset Pulsewidth
- 280 Register Summary
- 282 Instruction Set Summary
- 285 Ordering Information
- 286 Packaging Information
- 286 32A
- 287 28P3
- 288 32M1-A
- 289 Errata
- 289 ATmega8 Rev. D to I, M
- 291 Datasheet Revision History
- 291 Changes from Rev. 2486Y- 10/10 to Rev. 2486Z- 02/11
- 291 Changes from Rev. 2486X- 06/10 to Rev. 2486Y- 10/10
- 291 Changes from Rev. 2486W- 02/10 to Rev. 2486X- 06/10
- 291 Changes from Rev. 2486V- 05/09 to Rev. 2486W- 02/10
- 291 Changes from Rev. 2486U- 08/08 to Rev. 2486V- 05/09
- 291 Changes from Rev. 2486T- 05/08 to Rev. 2486U- 08/08
- 291 Changes from Rev. 2486S- 08/07 to Rev. 2486T- 05/08
- 292 Changes from Rev. 2486R- 07/07 to Rev. 2486S- 08/07
- 292 Changes from Rev. 2486Q- 10/06 to Rev. 2486R- 07/07
- 292 Changes from Rev. 2486P- 02/06 to Rev. 2486Q- 10/06
- 292 Changes from Rev. 2486O-10/04 to Rev. 2486P- 02/06
- 292 Changes from Rev. 2486N-09/04 to Rev. 2486O-10/04
- 293 Changes from Rev. 2486M-12/03 to Rev. 2486N-09/04
- 293 Changes from Rev. 2486L-10/03 to Rev. 2486M-12/03
- 293 Changes from Rev. 2486K-08/03 to Rev. 2486L-10/03
- 294 Changes from Rev. 2486J-02/03 to Rev. 2486K-08/03
- 294 Changes from Rev. 2486I-12/02 to Rev. 2486J-02/03
- 295 Changes from Rev. 2486H-09/02 to Rev. 2486I-12/02
- 295 Changes from Rev. 2486G-09/02 to Rev. 2486H-09/02
- 295 Changes from Rev. 2486F-07/02 to Rev. 2486G-09/02
- 295 Changes from Rev. 2486E-06/02 to Rev. 2486F-07/02
- 295 Changes from Rev. 2486D-03/02 to Rev. 2486E-06/02
- 295 Changes from Rev. 2486C-03/02 to Rev. 2486D-03/02
- 296 Changes from Rev. 2486B-12/01 to Rev. 2486C-03/02
- 297 Table of Contents