Toretycznie wg tego programu powinienem mieć na porcie B same jedynki a nastepnie je wygaszac. Podłączyłem wyjscia portu B pod diody i tylko PB0 i PB1 działają. Nawet PORTD i PORTC nie działa. Dodam że to moje pierwsze starcie z AVRami.
#define F_CPU 1000000L
#include <avr/io.h>
#include <util/delay.h>
int main(void)
{
DDRB |= _BV(0)|_BV(1);
PORTB |= _BV(0);
PORTB &= ~_BV(1);
DDRD &= ~_BV(0);
PORTD |= _BV(0);
volatile int liczba = 0;
while (1)
{
PORTB =0xFF;
PORTC =0x00;
PORTD =0x00;
_delay_ms(1000);
PORTB ^= _BV(0);
_delay_ms(1000);
PORTB ^= _BV(1);
_delay_ms(1000);
PORTB ^= _BV(2);
_delay_ms(1000);
PORTB ^= _BV(3);
_delay_ms(1000);
PORTB ^= _BV(4);
_delay_ms(1000);
PORTB ^= _BV(5);
_delay_ms(1000);
PORTB ^= _BV(6);
_delay_ms(1000);
PORTB ^= _BV(7);
}
}
