“变频”智能水位控制,数码管显示
【源码目录】“变频”智能水位控制电路├── 水位.C
├── 水位.hex
└── 水位MyDesign.ddb
0 directories, 3 files
#include <REGX52.H>#include <absacc.h>
#define uchar unsigned char
#define uint unsigned int
uchar code SEG7[10]={0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x07,0x7f, 0x6f };
sbit L0=P1^0;
sbit L1=P1^1;
sbit L2=P1^2;
sbit L3=P1^3;
sbit L4=P1^4;
sbit L5=P1^5;
sbit L6=P1^6;
sbit L7=P1^7;
sbit H0=P2^0;
sbit H1=P2^1;
sbit H2=P2^2;
sbit H3=P2^3;
sbit H4=P2^4;
sbit H5=P2^5;
sbit H6=P2^6;
sbit H7=P2^7;
sbit GATE=P3^0;
sbit S1=P3^1;
uchar LI0=0 ;
uchar LI1 ;
uchar LI2 ;
uchar LI3 ;
// ¼üÏû¶¶µÄÑÓʱº¯Êý
uint T,S;
void delays(T)
{
uint i ;
uint j;
for(i=T;i>0;i--);
for(j=200 ;j>0;j--);
}
//·äÃùÆ÷Ïì
void bells (S)
{uint k ;
uint l;
for(k=S;k>0;k--);
for(l=2 ;l>0;l--);
{if (LI0==1) GATE=1; else GATE=0; }
}
//ÏÔʾP0¿Ú
void disp(void )
{
uchar a=0;
if(L0==0) a=0;
if(L1==0) a=1;
if(L2==0) a=2;
if(L3==0) a=3;
P0=SEG7[ a];
}
void main(void)
{
disp( );
if (S1==0) {LI0 ;if(LI0>=2)LI0=0;};
if(L0 ==0)
{L4=0;
H0=0;
delays(300);
delays(3000);
delays(3000);
delays(3000);
delays(3000 );
L4= 1;
}
;
评论