Unconnected Pins; Alternative Functions Of Port B; The Port B Data Direction Register - Ddrb - Atmel AVR ATtiny15L Manual

Microcontroller with 1k byte flash
Hide thumbs Also See for AVR ATtiny15L:
Table of Contents

Advertisement

I/O Port B

Unconnected Pins

Alternative Functions of
Port B
The Port B Data Register –
PORTB
The Port B Data Direction
Register – DDRB
1187H–AVR–09/07
All AVR ports have true read-modify-write functionality when used as general digital I/O
ports. This means that the direction of one port pin can be changed without unintention-
ally changing the direction of any other pin with the SBI and CBI instructions. The same
applies for changing drive value (if configured as output) or enabling/disabling of pull-up
resistors (if configured as input).
Port B is a 6-bit bi-directional I/O port.
Three data memory address locations are allocated for Port B, one each for the Data
Register – PORTB, $18, Data Direction Register – DDRB, $17, and the Port B Input
Pins – PINB, $16. The Port B Input Pins address is read-only, while the Data Register
and the Data Direction Register are read/write.
Ports PB5..0 have special functions as described in the section "Pin Descriptions" on
page 4. If PB5 is not configured as External Reset, it is input with no pull-up or as an
open-drain output. All I/O pins have individually selectable pull-ups, which can be over-
ridden with pull-up disable.
The Port B output buffers on PB0 to PB4 can sink 20 mA and thus drive LED displays
directly. PB5 can sink 12 mA. When pins PB0 to PB4 are used as inputs and are exter-
nally pulled low, they will source current (I
If some pins are unused, it is recommended to ensure that these pins have a defined
level. The simplest method to ensure a defined level of an unused pin, is to enable the
internal pull-up. In this case, the pull-up will be disabled during reset. If low power con-
sumption during reset is important, it is recommended to use an external pull-up or pull-
down. Connecting unused pins directly to Vcc or GND is not recommended, since this
may cause excessive currents if the pin is accidentally configured as an output.
In ATtiny15L four Port B pins – PB2, PB3, PB4, and PB5 – have alternative functions as
inputs for the ADC. If some Port B pins are configured as outputs, it is essential that
these do not switch when a conversion is in progress. This might corrupt the result of the
conversion. During Power-down mode and ADC Noise Reduction mode, the Schmitt
triggers of the digital inputs are disconnected on these pins. This allows an analog input
voltage close to V
/2 to be present during Power-down without causing excessive
CC
power consumption. The Port B pins with alternate functions are shown in Table 1 on
page 4.
When the pins PB4..0 are used for the alternate function, the DDRB and PORTB Regis-
ters have to be set according to the alternate function description. When PB5 is used as
External Reset pin, the values in the corresponding DDRB and PORTB bit are ignored.
Bit
7
6
$18
Read/Write
R
R
Initial Value
0
0
Bit
7
6
$17
Read/Write
R
R
Initial Value
0
0
) if the internal pull-ups are activated.
IL
5
4
3
PORTB4
PORTB3
R
R/W
R/WS
0
0
0
5
4
3
DDB5
DDB4
DDB3
R/W
R/W
R/W
0
0
0
ATtiny15L
2
1
0
PORTB2
PORTB1
PORTB0
R/W
R/W
R/W
0
0
0
2
1
0
DDB2
DDB1
DDB0
R/W
R/W
R/W
0
0
0
PORTB
DDRB
51

Advertisement

Table of Contents
loading

Table of Contents