Professional Documents
Culture Documents
Microcontroller
Courtesy: AVR ATmega8 Datasheet
Unit – III
ATmega8 Microcontroller
Dr. J. Siva
1
Microcontrollers vs Microprocessor
Choosing a Microcontroller
• Word length (ALU size)
• Speed
• Packaging
• On-chip Peripherals
• I/O Pins
• Memory
• Power consumption
• Cost
• Upgarde
• Development tools
AVR CPU core
Features of AVR ATmega8
Pin Configuration of AVR ATmega8
ATmega8 – Data Memory Map
ATmega8 – Register file
AVR ATmega8 I/O Ports
• Port B (8-bit): PB7 – PB0
• Port C (7-bit): PC6 – PC0
• Port D (8-bit): PD7 – PD0
• All AVR ports have true Read-Modify-Write functionality when used as
general digital I/O Ports
• All port pins have individually selectable pull-up resistors
• Three I/O memory address locations are allocated for each port, one each
– Data Register : PORTx,
– Data Direction Register : DDRx,
– Pin Register : PINx
• The PIN reg I/O location is read only
• Data Register (PORTx) and the Data Direction Register (DDRx) are
read/writable
• Enabling the alternate function of some of the port pins does not affect
the use of the other pins in the port as general digital I/O
AVR ATmega8 I/O Ports
•The DDRxn bit in the DDRx Register selects the direction of this
pin.
•If DDRxn is written logic one, Pxn is configured as an output pin.
•If DDRxn is written logic zero, Pxn is configured as an input pin.
AVR ATmega8 I/O Ports
Always keep the internal pull-up enabled for digital I/P pins.
AVR ATmega8 I/O Ports