Blinking LED with ATMega8 won't blink
Four problems


You are using a resistor voltage divider to power your MCU. Bad. Bad bad. You need a proper regulator. Or a USB (IE 5v) power supply. Heck, use 3 AA batteries instead of a 9v if you don't have a regulator. The ATMega line can take what, 2.5 to 5v normal range? You have nothing that really depends on a full 5v, no clock sensitive/dependent code.
You only power one side of the ATMega. There are two power and two ground pins. They are NOT redundant. One set is Digital VCC and GND, the other is Analog VCC and GND. Ideally, you should use an inductor between the DVCC and AVCC pins, for noise sensitive analog circuits, but at the minimum, DVCC and AVCC should be connected, as should DGnd and AGnd.
A decoupling cap for both (~0.1uf) is recommended as well, but you could just use one for DVCC/DGnd.
You use a Bitwise And (&amp;). Only bits that are already set, will be set. [0 &amp; 1 = 0] [1 &amp; 0 = 0] [0 &amp; 0 = 0] [1 &amp; 1 = 1]Your code will never toggle the led on. You need a Bitwise OR | (the vertical bar or pipe) to turn it on. A Bitwise And with an inverted bit will turn it off (PortB &amp;= ~0x01). Alternatively, a Bitwise XOR ^ (caret symbol) can be used to toggle.




PORTB |= 0x01;
sleep(500);

PORTB &amp;= ~0x01;
sleep(500);

PORTB ^= 0x01;
sleep(500);


AVR Freaks has a great tutorial on bitwise operations here, for general C but they also focus on AVR/Atmega/Attiny, including port/bit manipulation.