Program:
Output:
/* * Buzer_Project.c * * Created: 3/14/2020 12:23:57 PM * Author: Atharv Agrawal */ #define F_CPU 14745600 #include <avr/io.h> #include<util/delay.h> void buzzer_init(void) { DDRC = DDRC | 0x08; PORTC &= 0XF7; } void buzzer_on() { PORTC |=0x08; } void buzzer_off() { PORTC &=0XF7; } int main(void) { buzzer_init(); int i = 0; while(i < 10) { i++; buzzer_on(); } }
Output: