AVR Sample code for LED Flashing
Sample code for AVR ATmega16.
//LED Flashing
#include <avr/io.h>
#include <util/delay.h>
#ifndef cbi
#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))
#endif
#ifndef sbi
#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit))
#endif
int main(void)
{
sbi(DDRD,1);
while(1)
{
sbi(PORTD,1);
//This will turn ON LED
_delay_ms(4000);
cbi(PORTD,1);
//This will turn OFF LED
_delay_ms(4000);
}
return 0;
}
Highlights
-
List of Projects
Navigate through wide range of projects of 8051. Applications including ADC, DAC, LCD, Matrix LEDs, Keypad, Stepper Motor, DC motor, EEPROM, Relay, Timer, Sensors, RTC and much more.
Pick and Place Robot Temperature & Light Controller Rolling Display Matrix LEDs Person Counter & Password Detector Home Security System Data Logger Greenhouse monitor & control Flow computer Electronic Voting Machine Pick & Place Robot Temperature & Light Controller Rolling Display Matrix LEDs Person Counter & Password Detector Data Logger Home Security System Greenhouse monitor & control Flow computer
Read More