?? 旋轉led.c
字號:
/*******************************************************************
名稱:旋轉LED
*******************************************************************/
#include<REG2051.H>
#define uchar unsigned char
void delay();
uchar zimo[16]={0xff,0x7d,0x00,0x7d,0xff, //字母“I”
0xc7,0x83,0xc1,0x83,0xc7, //心形圖案
0xff, //用來擱開心形圖案和字母U
0x03,0xfd,0xfd,0xfd,0x03}; //字母“U”
void main()
{TCON|=0x01; //外部中斷0下降沿觸發
IE=0x81; //開中斷
while(1);
}
void delay() //延時子程序,延時長短請根據的你的電機轉速進行調整
{uchar j;
for(j=0;j<255;j++)
{;}
}
void display() interrupt 0 //中斷處理
{uchar i;
for(i=0;i<16;i++)
{P1=zimo[i];
delay();}
P1=0xff;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -