標(biāo)題:
單片機(jī)點(diǎn)亮八路彩燈源程序
[打印本頁(yè)]
作者:
XCYYLX
時(shí)間:
2022-3-18 09:27
標(biāo)題:
單片機(jī)點(diǎn)亮八路彩燈源程序
//運(yùn)用if else if ele的語(yǔ)句來(lái)完成發(fā)光程序
#include<reg51.h>
#define uint unsigned int//定義uint為無(wú)符號(hào)整型
#define uchar unsigned char//是表示之后代碼中的“uchar”全部代表“unsigned char”
void main(void)
{
uchar i;
while (1)
{
i=P2;
if(i==0xff) P1=~i;
else if(i==0xfe) P1=0xfe;
else if(i==0xf0) P1=0xf0;
else if(i==0x55) P1=0x55;
else if(i==0xaa) P1=0xaa;
else P1=0xff;
}
}
歡迎光臨 (http://www.torrancerestoration.com/bbs/)
Powered by Discuz! X3.1