Recall & Review
beginner
What does configuring a pin as an input mean in embedded C?
Configuring a pin as input means setting it to read signals from external devices, like buttons or sensors, so the microcontroller can detect changes.
Click to reveal answer
beginner
How do you configure a pin as output in embedded C?
You set the pin direction register bit to 1 for that pin, which allows the microcontroller to send signals out, like turning on an LED.
Click to reveal answer
intermediate
Why is it important to configure pins correctly as input or output?
Correct configuration prevents damage and ensures the microcontroller communicates properly with other devices by either sending or receiving signals as intended.
Click to reveal answer
beginner
Example: What does this code do? DDRB |= (1 << 3);
This sets pin 3 of port B as an output by setting the third bit of the DDRB register to 1.
Click to reveal answer
intermediate
Example: How to configure pin 2 of port D as input with pull-up resistor enabled?
Clear bit 2 in DDRD to 0 (input), then set bit 2 in PORTD to 1 to enable the internal pull-up resistor.
Click to reveal answer
What does setting a pin's DDR register bit to 0 do?
✗ Incorrect
Setting the DDR bit to 0 configures the pin as input, allowing it to read signals.
Which register controls whether a pin is input or output?
✗ Incorrect
The DDR (Data Direction Register) controls pin direction: 0 for input, 1 for output.
How do you enable an internal pull-up resistor on an input pin?
✗ Incorrect
For input pins, setting PORT bit to 1 enables the internal pull-up resistor.
What happens if you configure a pin as output but connect it to an input device?
✗ Incorrect
An output pin sends signals; if connected to an input device, it controls that device.
Which bit operation sets pin 5 of PORTC as output?
✗ Incorrect
Setting bit 5 of DDRC to 1 configures pin 5 as output.
Explain how to configure a microcontroller pin as input and enable its internal pull-up resistor.
Think about which registers control direction and pull-up.
You got /4 concepts.
Describe the steps and register changes needed to set a pin as output and turn on an LED connected to it.
Consider how output pins send signals.
You got /4 concepts.