//In Cerebot2, 4 LEDs (LD1, LD2, LD3, and LD4) are connected to PORTE which are named "user LEDs". //This program Toggles user LEDs (PORTE) in AVR Assembly Language. //Use AVR Studio IDE to make the hex file. //For more information see www.microdigitaled.com and www.digilentinc.com #include #define F_CPU 8000000L //XTAL = 8 MHz #include int main () { DDRA = 0xFF; //JA (port A) as output DDRC = 0xFF; //JB (port B) as output DDRE = 0xF0; //User LEDs as output while (1) { PORTA = 0x55; //JA(PORTA) = 0101 0101 B PORTC = 0x55; //JB(PORTC) = 0101 0101 B PORTE = 0x50; //PORTE = 0101 0000 B (LD1 = ON, LD2 = OFF, LD3 = ON, LD4 = OFF) _delay_ms(1000); //wait 1 second PORTA = 0xAA; //JA(PORTA) = 1010 1010 B PORTC = 0xAA; //JB(PORTC) = 1010 1010 B PORTE = 0xA0; //PORTE = 1010 0000 B (LD1 = OFF, LD2 = ON, LD3 = OFF, LD4 = ON) _delay_ms(1000); //wait 1 second } }