标题: 8路指示灯程序 [打印本页]

作者: 11031191445    时间: 2016-11-9 18:24
标题: 8路指示灯程序
#include<reg51.h>                                                  //头文件
#define uchar unsigned char                                        //宏定义,为方便编程
#define uint unsigned int
#define  KEY  P0                                                   //宏定义,将P0口定义为按键KEY
#define  LED  P1                                                   //宏定义,将P1口定义为LED
uchar keyvalue=0;                                                  //定义变量,存放按键值
//char code SST516[3] _at_ 0x003b;                                   //仿真器保留
main()                                                             //主函数
{
while(1)
{
  keyvalue=P0;                                                     //取按键值,存入keyvalue
  P1=keyvalue;                                                     //将按键值赋给P1口,驱动相应LED发光
}
}







欢迎光临 (http://www.51hei.com/bbs/) Powered by Discuz! X3.1