单片机跑马灯c语言程序:数码管倒计时10秒流水灯开始工作的仿真图
发布网友
发布时间:2022-04-24 23:37
我来回答
共3个回答
热心网友
时间:2023-10-14 22:34
#include <reg51.h>
void delay(unsigned int i); char LED;
char TAB[16]={0xC0,0xF9,0xA4,0xB0,0x99,//共阳极0~4数码管显示数据
0x92,0x82,0xF8,0x80,0x98,//共阳极4~9数码管显示数据
0xA0,0x83,0xa7,0xa1,0x84,0x8e};
main()
{
unsigned char i;
while (1)
{ LED = 0xfe;
for (i = 0 ;i < 8 ; i++)
{
P0 = LED;
delay(500);
LED = LED << 1; LED = LED | 0x01; if (LED == 0x7f) break; }
for (i = 0 ;i < 8 ; i++)
{
P0 = LED;
delay(500);
LED = LED >> 1; LED = LED | 0x80;
}
}
}
while(1)
{
a[0]=*s%10; //给显示数组赋值
a[1]=*s/10;
a[2]=10;
a[3]=*m%10;
a[4]=*m/10;
a[5]=10;
/*******延时函数*************/
void delay(unsigned int i)
{
unsigned char j;
for(i; i > 0; i--)
for(j = 255; j > 0; j--);
}
热心网友
时间:2023-10-14 22:34
程序 电路仿真 资料 帮你搞定
热心网友
时间:2023-10-14 22:35
我来帮你!