1.数码管前三位显示一个跑表,从000到999之间以1%秒速度运行,当按下一个独立键盘时跑表停止,松开手后跑表继续运行。(用定时器设计表)。
code:
#include
#define uchar unsigned char
#define uint unsigned int
sbit key1 = P3^4;
sbit dula = P2^6;
sbit wela = P2^7;
uchar code table[]={
0x3f,0x06,0x5b,0x4f,
0x66,0x6d,0x7d,0x07,
0x7f,0x6f,0x77,0x7c,
0x39,0x5e,0x79,0x71};
uint num;
uchar bai, shi, ge, flag = 0,t0 = 0;
void delay(uchar z);
void display(void);
void main(void)
{
num = 0;
P3 = 0xff;
TMOD = 0x01;
TH0 = (65536-10000) / 256;
TL0 = (65536-10000) % 256;
EA = 1;
ET0 = 1;
TR0 = 1;
while(1) {
if(key1 == 0) {
delay(5);
if(key1 == 0) {
flag = 1;
}
while(!key1);
delay(5);
while(!key1);
}
display();
}
}
void display(void)
{
dula = 1;
P0 = table[num / 100];
dula = 0;
P0 = 0xff;
wela = 1;
P0 = 0xfe;
wela = 0;
delay(1);
dula = 1;
P0 = table[num % 100 / 10];
dula = 0;
P0 = 0xff;
wela = 1;
P0 = 0xfd;
wela = 0;
delay(1);
dula = 1;
P0 = table[num % 10];
dula = 0;
P0 = 0xff;
wela = 1;
P0 = 0xfb;
wela = 0;
delay(1);
}
void delay(uchar z)
{
uchar
#include
#define uchar unsigned char
uchar table[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f};
sbit key=P2^2;
sbit fmq=P2^3;
uchar dat;
void delay()//延时约10毫秒
{
uchar i,j;
for(i=0;i<10;i++)
for(j=0;j<120;j++);
}
main()
{
while(1)
{
if(key==0)
{
delay();
if(key==0)
{
fmq=0;
while(key==0);
fmq=1;
dat++;
dat%=10;
P1=table[dat];
}
}
}
}
#include
卫蘅与陆湛相恋,卫蘅却阴错阳差嫁给了自己有断袖之癖的表哥。三年后陆湛谋划让卫蘅和离,娶了卫蘅。婚后却对卫蘅冷若冰霜,更出言辱骂,本文从和气堂陆湛骂走卫蘅开始。卫蘅与陆湛相恋,卫蘅却阴错阳差嫁给了自己有断袖之癖的表哥。三年后陆湛谋划让卫蘅和离,娶了卫蘅。婚后却对卫蘅冷若冰霜,更出言辱骂,本文从和气堂陆湛骂走卫蘅开始。卫蘅与陆湛相恋,卫蘅却阴错阳差嫁给了自己有断袖之癖的表哥。三年后陆湛谋划让卫蘅和离,娶了卫蘅。婚后却对卫蘅冷若冰霜,更出言辱骂,本文从和气堂陆湛骂走卫蘅开始。卫蘅与陆湛相恋,卫蘅却阴错阳差嫁给了自己有断袖之癖的表哥。三年后陆湛谋划让卫蘅和离,娶了卫蘅。婚后却对卫蘅冷若冰霜,更出言辱骂,本文从和气堂陆湛骂走卫蘅开始。
🤔🤔🤔🤔🤔🤔