ATMEGA8L ATMEL [ATMEL Corporation], ATMEGA8L Datasheet - Page 171

no-image

ATMEGA8L

Manufacturer Part Number
ATMEGA8L
Description
8-bit AVR with 8K Bytes In-System Programmable Flash
Manufacturer
ATMEL [ATMEL Corporation]
Datasheets

Available stocks

Company
Part Number
Manufacturer
Quantity
Price
Part Number:
ATMEGA8L-6AU
Manufacturer:
ATMEL
Quantity:
675
Part Number:
ATMEGA8L-8AC
Manufacturer:
Atmel
Quantity:
10 000
Part Number:
ATMEGA8L-8AI
Manufacturer:
MICROCHIP
Quantity:
1 292
Part Number:
ATMEGA8L-8AI
Manufacturer:
Atmel
Quantity:
10 000
Part Number:
ATMEGA8L-8AI
Manufacturer:
ATMEL
Quantity:
8 000
Part Number:
ATMEGA8L-8AI
Manufacturer:
ALTERA
0
Part Number:
ATMEGA8L-8AJ
Manufacturer:
Atmel
Quantity:
10 000
Part Number:
ATMEGA8L-8AU
Manufacturer:
ATMEL
Quantity:
4 590
Part Number:
ATMEGA8L-8AU
Manufacturer:
Atmel
Quantity:
7 500
Part Number:
ATMEGA8L-8AU
Manufacturer:
ATMEL
Quantity:
591
Part Number:
ATMEGA8L-8AU
Manufacturer:
ATMEL/爱特梅尔
Quantity:
20 000
Company:
Part Number:
ATMEGA8L-8AU
Quantity:
7
Company:
Part Number:
ATMEGA8L-8AU
Quantity:
7
Using the TWI
2486M–AVR–12/03
The TWAR should be loaded with the 7-bit Slave address (in the seven most significant
bits of TWAR) to which the TWI will respond when programmed as a Slave Transmitter
or Receiver, and not needed in the Master modes. In multimaster systems, TWAR must
be set in masters which can be addressed as Slaves by other Masters.
The LSB of TWAR is used to enable recognition of the general call address (0x00).
There is an associated address comparator that looks for the slave address (or general
call address if enabled) in the received serial address. If a match is found, an interrupt
request is generated.
• Bits 7..1 – TWA: TWI (Slave) Address Register
These seven bits constitute the slave address of the TWI unit.
• Bit 0 – TWGCE: TWI General Call Recognition Enable Bit
If set, this bit enables the recognition of a General Call given over the Two-wire Serial
Bus.
The AVR TWI is byte-oriented and interrupt based. Interrupts are issued after all bus
events, like reception of a byte or transmission of a START condition. Because the TWI
is interrupt-based, the application software is free to carry on other operations during a
TWI byte transfer. Note that the TWI Interrupt Enable (TWIE) bit in TWCR together with
the Global Interrupt Enable bit in SREG allow the application to decide whether or not
assertion of the TWINT Flag should generate an interrupt request. If the TWIE bit is
cleared, the application must poll the TWINT Flag in order to detect actions on the TWI
bus.
When the TWINT Flag is asserted, the TWI has finished an operation and awaits appli-
cation response. In this case, the TWI Status Register (TWSR) contains a value
indicating the current state of the TWI bus. The application software can then decide
how the TWI should behave in the next TWI bus cycle by manipulating the TWCR and
TWDR Registers.
Figure 77 is a simple example of how the application can interface to the TWI hardware.
In this example, a Master wishes to transmit a single data byte to a Slave. This descrip-
tion is quite abstract, a more detailed explanation follows later in this section. A simple
code example implementing the desired behavior is also presented.
Read/Write
Initial Value
TWA6
R/W
1
TWA5
R/W
1
TWA4
R/W
1
TWA3
R/W
1
TWA2
R/W
1
TWA1
R/W
1
TWA0
ATmega8(L)
R/W
1
TWGCE
R/W
0
TWAR
171

Related parts for ATMEGA8L