atmega161-4pi ATMEL Corporation, atmega161-4pi Datasheet - Page 98

no-image

atmega161-4pi

Manufacturer Part Number
atmega161-4pi
Description
8-bit Microcontroller With 16k Bytes Of In-system Programmable Flash
Manufacturer
ATMEL Corporation
Datasheet
Port C
Port C Data Register – PORTC
Port C Data Direction Register
– DDRC
Port C Input Pins Address –
PINC
Port C as General Digital I/O
98
ATmega161(L)
Port C is an 8-bit bi-directional I/O port.
Three I/O memory address locations are allocated for the Port C, one each for the Data
Register – PORTC, $15($35), Data Direction Register – DDRC, $14($34) and the Port C
Input Pins – PINC, $13($33). The Port C Input Pins address is read-only, while the Data
Register and the Data Direction Register are read/write.
All port pins have individually selectable pull-up resistors. The Port C output buffers can
sink 20 mA and thus drive LED displays directly. When pins PC0 to PC7 are used as
inputs and are externally pulled low, they will source current if the internal pull-up resis-
tors are activated.
The Port C pins have alternate functions related to the optional external memory inter-
face. Port C can be configured to be the high-order address byte during accesses to
external Data memory.
When Port C is set to the alternate function by the SRE (External SRAM Enable) bit in
the MCUCR (MCU Control Register), the alternate settings override the Data Direction
Register.
The Port C Input Pins address (PINC) is not a register; this address enables access to
the physical value on each Port C pin. When reading PORTC, the Port C Data Latch is
read and when reading PINC, the logical values present on the pins are read.
All eight pins in Port C have equal functionality when used as digital I/O pins.
PCn, general I/O pin: The DDCn bit in the DDRC Register selects the direction of this
pin. If DDCn is set (one), PCn is configured as an output pin. If DDCn is cleared (zero),
PCn is configured as an input pin. If PORTCn is set (one) when the pin is configured as
an input pin, the MOS pull-up resistor is activated. To switch the pull-up resistor off,
PORTCn has to be cleared (zero) or the pin has to be configured as an output pin. The
Port C pins are tri-stated when a reset condition becomes active, even if the clock is not
running.
Bit
$15 ($35)
Read/Write
Initial Value
Bit
$14 ($34)
Read/Write
Initial Value
Bit
$13 ($33)
Read/Write
Initial Value
PORTC7
PINC7
DDC7
R/W
N/A
R/W
R
7
7
0
7
0
PORTC6
PINC6
DDC6
R/W
N/A
R/W
R
6
0
6
6
0
PORTC5
PINC5
R/W
DDC5
N/A
R/W
5
0
R
5
5
0
PORTC4
PINC4
R/W
DDC4
N/A
R/W
4
0
R
4
4
0
PORTC3
PINC3
R/W
DDC3
N/A
R/W
3
0
R
3
3
0
PORTC2
PINC2
R/W
DDC2
N/A
R/W
2
0
R
2
2
0
PORTC1
PINC1
R/W
DDC1
N/A
R/W
1
0
R
1
1
0
PORTC0
PINC0
R/W
1228D–AVR–02/07
DDC0
N/A
R/W
0
0
R
0
0
0
PORTC
DDRC
PINC

Related parts for atmega161-4pi