您的位置 首页 知识

AVR128的程序——独立按键操控LED灯闪耀

includeiom128vh>includemacrosh>defineucharunsignedchardefineuintunsignedintvoidDelayms(uintMS)

#include

#include
#define uchar unsigned char
#define uint unsigned int
void Delayms(uint MS);
void main(void)
{
DDRA = 0XFF;
PORTA = 0XFF;
DDRC=0XFF;
PORTC=0XFF;
DDRF|=0X0E;
PORTF|=0X0E;
PORTF&=0xF8;
DDRD = 0x00;
PORTD = 0XFF;
DDRB |= 0X10;
PORTB |= 0X10;
while(1)
{
if((PIND&0x0F)!=0x0F);
Delayms(5);
if((PIND&0x0F)!=0x0F)
{
if((PIND&0x01)==0)
PORTA&=~(1<
if((PIND&0x02)==0)
PORTA&=~(1<
if((PIND&0x04)==0)
PORTA&=~(1<
if((PIND&0x08)==0)
PORTA&=~(1<
Delayms(5);
while((PIND&0x0F)!=0x0F);
PORTA = 0xFF;
}
}
}
void Delayms(uint MS)
{
uint i,j;
for( i=0;i
for(j=0;j<1141;j++);
}

声明:本文内容来自网络转载或用户投稿,文章版权归原作者和原出处所有。文中观点,不代表本站立场。若有侵权请联系本站删除(kf@86ic.com)https://www.86ic.net/zhishi/262325.html

为您推荐

联系我们

联系我们

在线咨询: QQ交谈

邮箱: kf@86ic.com

关注微信
微信扫一扫关注我们

微信扫一扫关注我们

返回顶部