1
0
mirror of synced 2024-06-12 02:09:49 +02:00

Example of writing value directly to PORTD.

This commit is contained in:
Mika Tuupola 2009-12-25 17:55:36 +02:00
parent cbfdba0f68
commit b9a7ad4a88

View File

@ -37,6 +37,11 @@ int main(void) {
/* Toggle led at PORTB5 */
PORTB ^= _BV(PORTB5);
/* Short way would be to directly write the value to PORTD. */
/* Shift by 2 because first TIL311 port is PORTD2. However */
/* This would zero PORTD0, PORTD1, PORTD6 and PORTD7. */
/* PORTD = value << 2; */
/* TIL311 pin 3, latch data input A (1). */
if (0 == BIT_AT(value, 0)) {
PORTD &= ~(_BV(PORTD2));
@ -64,6 +69,7 @@ int main(void) {
} else {
PORTD |= _BV(PORTD5);
}
value++;
_delay_ms(500);
}