void uart_send(unsigned char *msg,unsigned char cnt,bit flag)
答案:1 悬赏:60 手机版
解决时间 2021-11-08 20:23
- 提问者网友:杀生予夺
- 2021-11-08 17:29
void uart_send(unsigned char *msg,unsigned char cnt,bit flag)
最佳答案
- 五星知识达人网友:末日狂欢
- 2021-11-08 19:09
行了:
#include
xdata unsigned char OUTBIT _at_ 0x8002;
xdata unsigned char OUTSEG _at_ 0x8004;
unsigned char LEDBuf[6];
code unsigned char LEDMAP[] = {
0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,
0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71};
void Delay(unsigned char CNT)
{
unsigned char i;
while(CNT-- != 0) for(i = 100; i != 0; i--);
}
void DisplayLED()
{
unsigned char i;
unsigned char Pos;
Pos = 0x20;
for(i = 0; i < 6; i++) {
OUTBIT = 0;
OUTSEG = LEDBuf[i];
OUTBIT = Pos;
Pos >>= 1;
Delay(150);
}
}
void main()
{
unsigned char i = 0;
unsigned char j;
while(1) {
LEDBuf[0] = LEDMAP[j];
j++;
if(j > 15) j = 0;
LEDBuf[1] = LEDMAP[j];
j++;
if(j > 15) j = 0;
LEDBuf[2] = LEDMAP[j];
j++;
if(j > 15) j = 0;
LEDBuf[3] = LEDMAP[j];
j++;
if(j > 15) j = 0;
LEDBuf[4] = LEDMAP[j];
j++;
if(j > 15) j = 0;
LEDBuf[5] = LEDMAP[j];
i++;
if(i > 15) i = 0;
j = i;
DisplayLED();
}
}
#include
xdata unsigned char OUTBIT _at_ 0x8002;
xdata unsigned char OUTSEG _at_ 0x8004;
unsigned char LEDBuf[6];
code unsigned char LEDMAP[] = {
0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,
0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71};
void Delay(unsigned char CNT)
{
unsigned char i;
while(CNT-- != 0) for(i = 100; i != 0; i--);
}
void DisplayLED()
{
unsigned char i;
unsigned char Pos;
Pos = 0x20;
for(i = 0; i < 6; i++) {
OUTBIT = 0;
OUTSEG = LEDBuf[i];
OUTBIT = Pos;
Pos >>= 1;
Delay(150);
}
}
void main()
{
unsigned char i = 0;
unsigned char j;
while(1) {
LEDBuf[0] = LEDMAP[j];
j++;
if(j > 15) j = 0;
LEDBuf[1] = LEDMAP[j];
j++;
if(j > 15) j = 0;
LEDBuf[2] = LEDMAP[j];
j++;
if(j > 15) j = 0;
LEDBuf[3] = LEDMAP[j];
j++;
if(j > 15) j = 0;
LEDBuf[4] = LEDMAP[j];
j++;
if(j > 15) j = 0;
LEDBuf[5] = LEDMAP[j];
i++;
if(i > 15) i = 0;
j = i;
DisplayLED();
}
}
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯