📄 main.c
字号:
#include <reg51.h>
typedef unsigned char BYTE;
sbit P00=P0^0;
sbit P01=P0^1;
BYTE code TAB1[]={ 0x02,0x06,0x04,0x0C,
0x08,0x09,0x01,0x03};
void DELAY()
{
BYTE i=5;
do
{
BYTE j=0x80;
do
{
BYTE k=0;
do
{
}while(--k);
}while(--j);
}while(--i);
}
main()
{
BYTE r0=3;
BYTE r4=0;
P1=3;
while(1)
{
P1=r0;
P0=0xFF;
if(!P00)
{
P1=TAB1[r4++];
DELAY();
}
else if(!P01)
{
r4=6;
P1=TAB1[r4];
DELAY();
}
while(1)
{
P0=0x03;
if(P00)
{
if(P01) continue;
if(r4==255) r4=7;
P1=TAB1[--r4];
DELAY();
}
else
{
if(r4==8) r4=0;
P1=TAB1[r4++];
DELAY();
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -