?? 01.c
字號:
#include<reg52.h>
#define uint unsigned int
#define uchar unsigned char
sbit h1=P2^0;
sbit h2=P2^1;
sbit l1=P2^2;
sbit l2=P2^3;
//======================================================================
//延時子程序//
//======================================================================
void delay(uint z)
{
uint x,y;
for(x=z;x>0;x--)
for(y=110;y>0;y--);
}
void display1()
{
h1=0;
h2=0;
l1=0;
l2=0;
h1=1;
P0=0xfe;
h1=0;
h2=1;
P0=0xff;
h2=0;
l1=1;
P0=0x01;
l1=0;
l2=1;
P0=0x00;
l2=0;
}
void display2()
{
h1=0;
h2=0;
l1=0;
l2=0;
h1=1;
h2=1;
P0=0x00;
h1=0;
h2=0;
delay(200);
l1=1;
l2=1;
P0=0xff;
l1=0;
l2=0;
delay(200);
}
void main()
{
//display1();
while(1)
{
display2();
}
}
/*
h1=1;
h2=1;
P0=0x00;
h1=0;
h2=0;
l1=1;
l2=1;
P0=0xff;
l1=0;
l2=0;
delay(500);
l1=1;
l2=1;
P0=0x00;
l1=0;
l2=0;
delay(500);//閃動
*/
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -