新闻中心

EEPW首页 > 嵌入式系统 > 设计应用 > PIC16F877A例程--LED

PIC16F877A例程--LED

作者: 时间:2016-11-24 来源:网络 收藏
#include //调用头文件

#include

本文引用地址:https://www.eepw.com.cn/article/201611/321020.htm

__CONFIG(0x3F32); //芯片配置字

typedef unsigned char uchar;

typedef unsigned int uint;

void delay(uint z);

void main (void)

{

uchar temp;

TRISA=0XC0; //RA0-RA5设为输出驱动六个LED

for(;;)

for(temp=0xfe;temp!=0x80;temp<<=1)

{

PORTA=temp;

delay(1000);

}

}

void delay(uint z )

{

uint x,y;

for(x=z;x--;x>0)

for(y=40;y--;y>0);

}



关键词: PIC16F877ALE

评论


技术专区

关闭