#include<iom16v.h>
#include<macros.h>
#define uchar unsigned char
#define uint unsigned int
#define DELAY 500
void delay(uint z) //1ms
{
uint x,y;
for(x=z;x>0;x--)
for(y=157;y>0;y--);
}
void main(void)
{
DDRA |=BIT(0);
while(1)
{
PORTA &=~BIT(0);
delay(DELAY);
PORTA |=BIT(0);
delay(DELAY);
}
}
AVR单片机(ATMEGA16)控制蜂鸣器
最新推荐文章于 2024-08-28 10:32:10 发布