beautypg.com

5 ddrb - port b data direction register, 6 pinb - port b input pins address, 7 portd - port d data register – Rainbow Electronics ATmega128RFA1 User Manual

Page 206: Atmega128rfa1

background image

206



8266A-MCU Wireless-12/09

ATmega128RFA1

logic zero or the pin has to be configured as an output pin. If PORTBn is written logic
one when the pin is configured as an output pin, the port pin is driven high (one). If
PORTBn is written logic zero when the pin is configured as an output pin, the port pin is
driven low (zero).

Bit 7:0 – PORTB7:0 - Port B Data Register Value

14.4.5 DDRB – Port B Data Direction Register

Bit

7

6

5

4

3

2

1

0

$04 ($24)

DDB7

DDB6

DDB5

DDB4

DDB3

DDB2

DDB1

DDB0

DDRB

Read/Write

RW

RW

RW

RW

RW

RW

RW

RW

Initial Value

0

0

0

0

0

0

0

0

The DDBn bit in the DDRB Register selects the direction of the PORTB pin n. If DDBn
is written logic one, PBn is configured as an output pin. If DDBn is written logic zero,
PBn is configured as an input pin.

Bit 7:0 – DDB7:0 - Port B Data Direction Register Value

14.4.6 PINB – Port B Input Pins Address

Bit

7

6

5

4

3

2

1

0

$03 ($23)

PINB7:0

PINB

Read/Write

R

R

R

R

R

R

R

R

Initial Value

0

0

0

0

0

0

0

0

This register allows access to the PORTB pins independent of the setting of the Data
Direction bit DDBn. The port pin can be read through the PINBn Register bit, and
writing a logic one to PINBn toggles the value of PORTBn.

Bit 7:0 – PINB7:0 - Port B Input Pins Value

14.4.7 PORTD – Port D Data Register

Bit

7

6

5

4

3

2

1

0

$0B ($2B)

PORTD7:0

PORTD

Read/Write

RW

RW

RW

RW

RW

RW

RW

RW

Initial Value

0

0

0

0

0

0

0

0

If PORTDn is written logic one when the PORTD pin n is configured as an input pin, the
pull-up resistor is activated. To switch the pull-up resistor off, PORTDn has to be written
logic zero or the pin has to be configured as an output pin. If PORTDn is written logic
one when the pin is configured as an output pin, the port pin is driven high (one). If
PORTDn is written logic zero when the pin is configured as an output pin, the port pin is
driven low (zero).

Bit 7:0 – PORTD7:0 - Port D Data Register Value