ATmega8A Atmel Corporation, ATmega8A Datasheet - Page 176

no-image

ATmega8A

Manufacturer Part Number
ATmega8A
Description
Manufacturer
Atmel Corporation
Datasheets

Specifications of ATmega8A

Flash (kbytes)
8 Kbytes
Pin Count
32
Max. Operating Frequency
16 MHz
Cpu
8-bit AVR
# Of Touch Channels
12
Hardware Qtouch Acquisition
No
Max I/o Pins
23
Ext Interrupts
2
Usb Speed
No
Usb Interface
No
Spi
1
Twi (i2c)
1
Uart
1
Graphic Lcd
No
Video Decoder
No
Camera Interface
No
Adc Channels
8
Adc Resolution (bits)
10
Adc Speed (ksps)
15
Analog Comparators
1
Resistive Touch Screen
No
Temp. Sensor
No
Crypto Engine
No
Sram (kbytes)
1
Eeprom (bytes)
512
Self Program Memory
YES
Dram Memory
No
Nand Interface
No
Picopower
No
Temp. Range (deg C)
-40 to 85
I/o Supply Class
2.7 to 5.5
Operating Voltage (vcc)
2.7 to 5.5
Fpu
No
Mpu / Mmu
no / no
Timers
3
Pwm Channels
3
32khz Rtc
Yes
Calibrated Rc Oscillator
Yes

Available stocks

Company
Part Number
Manufacturer
Quantity
Price
Part Number:
ATMEGA8A
Manufacturer:
ATMEL
Quantity:
530
Part Number:
ATmega8A-AN
Manufacturer:
Atmel
Quantity:
10 000
Part Number:
ATmega8A-ANR
Manufacturer:
Atmel
Quantity:
2 034
Part Number:
ATmega8A-ANR
Manufacturer:
Atmel
Quantity:
10 000
Part Number:
ATmega8A-AU
Manufacturer:
NXP
Quantity:
1 001
Part Number:
ATmega8A-AU
Manufacturer:
ATM
Quantity:
10 000
Part Number:
ATmega8A-AU
Manufacturer:
Atmel
Quantity:
10 000
Part Number:
ATmega8A-AU
Manufacturer:
ATMEL
Quantity:
1 000
Part Number:
ATmega8A-AU
Manufacturer:
Microchip
Quantity:
1 000
Part Number:
ATmega8A-AU
Manufacturer:
ATMEL/爱特梅尔
Quantity:
20 000
Company:
Part Number:
ATmega8A-AU
Quantity:
10 000
Part Number:
ATmega8A-MNR
Manufacturer:
Atmel
Quantity:
9 939
Part Number:
ATmega8A-MU
Manufacturer:
ATMEL/爱特梅尔
Quantity:
20 000
Part Number:
ATmega8A-PU
Manufacturer:
ATMEL/爱特梅尔
Quantity:
20 000
20.6.1
8159D–AVR–02/11
1
2
3
4
5
6
7
Assembly Code Example
ldi
out
wait1:
in
sbrs r16,TWINT
rjmp wait1
in
andi r16, 0xF8
cpi
brne ERROR
ldi
out
ldi
out
wait2:
in
sbrs r16,TWINT
rjmp wait2
in
andi r16, 0xF8
cpi
brne ERROR
ldi
out
ldi
out
wait3:
in
sbrs r16,TWINT
rjmp wait3
in
andi r16, 0xF8
cpi
brne ERROR
ldi
out
Transmission Modes
r16, (1<<TWINT)|(1<<TWSTA)|
(1<<TWEN)
TWCR, r16
r16,TWCR
r16,TWSR
r16, START
r16, SLA_W
TWDR, r16
r16, (1<<TWINT) | (1<<TWEN)
TWCR, r16
r16,TWCR
r16,TWSR
r16, MT_SLA_ACK
r16, DATA
TWDR, r16
r16, (1<<TWINT) | (1<<TWEN)
TWCR, r16
r16,TWCR
r16,TWSR
r16, MT_DATA_ACK
r16, (1<<TWINT)|(1<<TWEN)|
(1<<TWSTO)
TWCR, r16
The TWI can operate in one of four major modes. These are named Master Transmitter (MT),
Master Receiver (MR), Slave Transmitter (ST) and Slave Receiver (SR). Several of these
modes can be used in the same application. As an example, the TWI can use MT mode to write
data into a TWI EEPROM, MR mode to read the data back from the EEPROM. If other masters
C Example
TWCR = (1<<TWINT)|(1<<TWSTA)|
while (!(TWCR & (1<<TWINT)))
if ((TWSR & 0xF8) != START)
TWDR = SLA_W;
TWCR = (1<<TWINT) | (1<<TWEN);
while (!(TWCR & (1<<TWINT)))
if ((TWSR & 0xF8) !=
MT_SLA_ACK)
TWDR = DATA;
TWCR = (1<<TWINT) | (1<<TWEN);
while (!(TWCR & (1<<TWINT)))
if ((TWSR & 0xF8) !=
MT_DATA_ACK)
TWCR = (1<<TWINT)|(1<<TWEN)|
(1<<TWEN)
(1<<TWSTO);
;
ERROR();
;
ERROR();
;
ERROR();
Comments
Send START condition
Wait for TWINT Flag set. This
indicates that the START condition
has been transmitted
Check value of TWI Status
Register. Mask prescaler bits. If
status different from START go to
ERROR
Load SLA_W into TWDR Register.
Clear TWINT bit in TWCR to start
transmission of address
Wait for TWINT Flag set. This
indicates that the SLA+W has been
transmitted, and ACK/NACK has
been received.
Check value of TWI Status
Register. Mask prescaler bits. If
status different from MT_SLA_ACK
go to ERROR
Load DATA into TWDR Register.
Clear TWINT bit in TWCR to start
transmission of data
Wait for TWINT Flag set. This
indicates that the DATA has been
transmitted, and ACK/NACK has
been received.
Check value of TWI Status
Register. Mask prescaler bits. If
status different from
MT_DATA_ACK go to ERROR
Transmit STOP condition
ATmega8A
176

Related parts for ATmega8A