EmbeddedSystems/EmbeddedSystemsTHM/Led.c

80 lines
996 B
C

#include <avr/io.h>
void
Led_init (void){
DDRB = 0xFF; // Set all bits in the B Data-Direction Register to output
PORTB = 0x00; // Set all bits in the PORT B Register to low to turn all LEDs off
}
void
Led1_On (void){
PORTB |= (1<<7); // Set the bit for LED_1 to hight to turn it on
}
void
Led1_Off (void){
PORTB &= ~(1<<7); // Set the bit for LED_1 to low to turn it off
}
void
Led2_On (void){
PORTB |= (1<<6);
}
void
Led2_Off (void){
PORTB &= ~(1<<6);
}
void
Led3_On (void){
PORTB |= (1<<5);
}
void
Led3_Off (void){
PORTB &= ~(1<<5);
}
void
Led4_On (void){
PORTB |= (1<<4);
}
void
Led4_Off (void){
PORTB &= ~(1<<4);
}
void
Led5_On (void){
PORTB |= (1<<3);
}
void
Led5_Off (void){
PORTB &= ~(1<<3);
}
void
Led6_On (void){
PORTB |= (1<<2);
}
void
Led6_Off (void){
PORTB &= ~(1<<2);
}
void
Led7_On (void){
PORTB |= (1<<1);
}
void
Led7_Off (void){
PORTB &= ~(1<<1);
}
void
Led8_On (void){
PORTB |= (1<<0);
}
void
Led8_Off (void){
PORTB &= ~(1<<0);
}