Hello
Under debbug in first loop AVR studio not refresh status of register of PORTC marked on red. When it execute and go second time then its OK - PORTC show good values. Please see photo - PORTC will be 0x56 but not 0x00 in this time!!! What happens????
device ATMEGA16A
AVR Studio version 4.18 build 716
version AVRGCC: WinAVR20100110
my code:
#define F_CPU 12000000 #include#include int main (void) { int licznik; for (licznik=0;licznik<256;++licznik) { _delay_us(100); PORTD = licznik; } unsigned char counter; counter = 1; //set PORTB for output DDRC = 0xFF; while (1) { PORTC = 0x55; PORTC = 0x56; PORTC = 0x57; PORTC = 0x58; PORTC = 0x59; PORTC = 0x60; _delay_us(1); PORTC = 0xAA; _delay_us(1); } return 1; }
and results of builds :
Build started 7.1.2011 at 14:28:03 AVR Memory Usage ---------------- Device: atmega16a Program: 186 bytes (1.1% Full) (.text + .data + .bootloader) Data: 0 bytes (0.0% Full) (.data + .bss + .noinit) Build succeeded with 0 Warnings...