单片机警告 我就只想用点阵的发光二极管显示一个英文I
#include<REGX52.H>#defineuintunsignedint#defineucharunsignedcharsbith1=P2^1;sbith2=P2...
#include <REGX52.H>
#define uint unsigned int
#define uchar unsigned char
sbit h1=P2^1;
sbit h2=P2^0;
sbit h3=P2^7;
sbit h4=P2^6;
sbit s1=P2^5;
sbit s2=P2^4;
sbit s3=P2^3;
sbit s4=P2^2;
void delayms(uint xms)
{
uint i,j;
for(i=xms;i>0;i++)
for(j=1320;j>0;j--);
}
void main()
{
h1=0;
h2=0;
h3=0;
h4=0;
s1=1;
s2=1;
s3=1;
s4=1;
while(1)
{
h1=1;
s1=0;
delayms(100);
s1=1;
s2=0;
delayms(100);
s2=1;
s3=0;
delayms(100);
h1=0;
s3=1;
s2=0;
delayms(100);
h2=0;
h3=1;
delayms(100);
s2=1;
s1= 0;
delayms(100);
s2=0;
s1=1;
delayms(100);
s2=1;
s3=0;
}
} 展开
#define uint unsigned int
#define uchar unsigned char
sbit h1=P2^1;
sbit h2=P2^0;
sbit h3=P2^7;
sbit h4=P2^6;
sbit s1=P2^5;
sbit s2=P2^4;
sbit s3=P2^3;
sbit s4=P2^2;
void delayms(uint xms)
{
uint i,j;
for(i=xms;i>0;i++)
for(j=1320;j>0;j--);
}
void main()
{
h1=0;
h2=0;
h3=0;
h4=0;
s1=1;
s2=1;
s3=1;
s4=1;
while(1)
{
h1=1;
s1=0;
delayms(100);
s1=1;
s2=0;
delayms(100);
s2=1;
s3=0;
delayms(100);
h1=0;
s3=1;
s2=0;
delayms(100);
h2=0;
h3=1;
delayms(100);
s2=1;
s1= 0;
delayms(100);
s2=0;
s1=1;
delayms(100);
s2=1;
s3=0;
}
} 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询