I have just started to study the AVR a week ago. The eight LEDs and registors are connected between the VCC and ATMEGA128 PORTB.
I found that some CodeVision C programs does not work as I expected. After careful examination of the codes, I can simplify the problem to the following Assembler coding. (PORTD.0 is connected to the chattering switch)
=2ECSEG _main: ; 8 PORTB=3D0xff; LDI R30,LOW(255) OUT 0x18,R30 ; 9 DDRB=3D0xFF; OUT 0x17,R30 ; 10 ; 11 PORTD=3D0x00; CLR R30 OUT 0x12,R30 ; 12 DDRD&=3D0xFE; CBI 0x11,0 ; 13 ;CALL __LSLB12 ;=3D=3D=3D=3D> If commented OK!!!!! But uncommented??