beautypg.com

Port b, Port b input pins address – pinb, Port b as general digital input – Rainbow Electronics ATtiny28L User Manual

Page 39: Alternate functions of port b, Attiny28l/v

background image

39

ATtiny28L/V

1062E–10/01

Port B

Port B is an 8-bit input port.

One I/O address location is allocated for the Port B Input Pins – PINB, $16. The Port B
Input Pins address is read-only.

All port pins have pull-ups that can be switched on for all Port B pins simultaneously. If
any of the Port B special functions is enabled, the corresponding pull-up(s) is disabled.
When pins PB0 to PB7 are externally pulled low, they will source current (I

IL

) if the inter-

nal pull-up resistors are activated.

The Port B pins with alternate functions are shown in Table 18.

Port B Input Pins Address –
PINB

The Port B Input Pins address (PINB) is not a register; this address enables access to
the physical value on each Port B pin. When reading PINB, the logical values present on
the pins are read.

Port B as General Digital Input All eight pins in Port B have equal functionality when used as digital input pins.

PBn, general input pin: To switch the pull-up resistors on, the PLUPB bit in the MCUCS
register must be set (one). This bit controls the pull-up on all Port B pins. To turn the
pull-ups off, this bit has to be cleared (zero). Note that if any Port B pins are used for
alternate functions, the pull-up on the corresponding pins are disabled. The port pins are
tri-stated when a reset condition becomes active, even if the clock is not running.

Alternate Functions of Port B

All Port B pins are connected to a low-level detector that can trigger the low-level input
interrupt. See “Low-level Input Interrupt” on page 21 for details. In addition, Port B has
the following alternate functions:

• INT1 – Port B, Bit 4

INT1, External Interrupt source 1. The PB4 pin can serve as an external interrupt source
to the MCU. See the interrupt description for details on how to enable and configure this
interrupt. If the interrupt is enabled, the pull-up resistor on PB4 is disabled and PB4 will
not give low-level interrupts.

• INT0 – Port B, Bit 3

INT0, External Interrupt source 0. The PB3 pin can serve as an external interrupt source
to the MCU. See the interrupt description for details on how to enable and configure this
interrupt. If the interrupt is enabled, the pull-up resistor on PB3 is disabled and PB3 will
not give low-level interrupts.

Table 18. Port B Pin Alternate Functions

Port Pin

Alternate Functions

PB0

AIN0 (Analog Comparator Positive Input)

PB1

AIN1 (Analog Comparator Negative Input)

PB2

T0 (Timer/Counter 0 External Counter Input)

PB3

INT0 (External Interrupt 0 Input)

PB4

INT1 (External Interrupt 1 Input)

Bit

7

6

5

4

3

2

1

0

$16

PINB7

PINB6

PINB5

PINB4

PINB3

PINB2

PINB1

PINB0

PINB

Read/Write

R

R

R

R

R

R

R

R

Initial Value

N/A

N/A

N/A

N/A

N/A

N/A

N/A

N/A