Peripherals

Digital IO Ports

As a digital input with pull-up resistors enabled


DDRB = 0x00; // Set PORTB (PB7) as an input

PORTB= 0xFF; // Enable pullups

input_variable = PINB; // Read PINB

As a tri stated digital input


DDRB = 0x00; // Set PORTB (PB7) as an input

PORTB= 0x00; // Disable pullups

input_variable = PINB; // Read PINB

As an output


DDRB = 0xFF; // Set PORTB (PB7) as an output

PORTB= 0x0F; // Set Upper and Lower nibbleS to logic 0 and 1 respectively
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s