单片机菜鸟问题啊 求解!!~~
unsignedcharcodes1[10]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};unsignedch...
unsigned char code s1[10]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};
unsigned char code s2[8]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};
sbit SCLK=P3^0;
sbit DATA=P3^1;
sbit RST=P3^2;
sbit k1=P3^3;
sbit k2=P3^4;
void delaynus(int n)
void fun(cmd,s1,s2,i)
unsigned char cmd,s1[10],s2[8],i ;
{
int a1,a2;
unsigned char a;
a=readset(cmd);
a1=a%10;
a2=a/10%10;
P0=s1[a1];
P1=s2[i++];
delay1ms(20);
P0=s1[a2];
P1=s2[i];
delay1ms(20);
}
void fun2(cmd,s1,s2,i)
unsigned char cmd,s1[10],s2[8],i ;
{
int a1,a2;
unsigned char a;
a=readset(cmd);
a1=a%10;
a2=a/10%10;
P0=s1[a1];
P2=s2[i++];
delay1ms(20);
P0=s1[a2];
P2=s2[i];
delay1ms(20);
}
void nian(s1,s2,i)
unsigned char s1[10],s2[8],i;
{
int a1,a2,a3,a4;
unsigned char a;
a=readset(0X8c);
a1=a%10;
a2=a/10%10;
a3=a/100%10;
a4=a/1000%10;
P0=s1[a1];P2=s2[i++];
delay1ms(20);
P0=s1[a2];P2=s2[i++];
delay1ms(20);
P0=s1[a3];P2=s2[i++];
delay1ms(20);
P0=s1[a4];P2=s2[i++];
delay1ms(20);
}
void xs(s1,s2,q,i)
unsigned char s1,s2;
int q,i;
{
int q1,q2;
q1=q%10;
q2=q/10%10;
P0=s1[q1];
P1=s2[i++];
delay1ms(20);
P0=s1[q2];
P1=s2[i++];
delay1ms(20);
}
void xs2(s1,s2,q,i)
unsigned char s1,s2;
int q,i;
{
int q1,q2,q3,q4;
q1=q%10;
q2=q/10%10;
q3=q/100%10;
q4=q/1000%10;
P0=s1[q1];P2=s2[i++];
delay1ms(20);
P0=s1[q2];P2=s2[i++];
delay1ms(20);
P0=s1[q3];P2=s2[i++];
delay1ms(20);
P0=s1[q4];P2=s2[i++];
delay1ms(20);
}
void zhou(s1)
unsigned char s1;
{
int b;
b=readset(0X8a);
P0=s1[b];
P2=0Xbf;
}
int sad(void)
{
int i=1,n=0;
while(i)
{
if(k1==0)
delay1ms(20);
if(k1==0)
n++;
if(n>8)
n=1;
if(k1!=0)
{
delay1ms(100);
if(k1!=0)
{delay1ms(100);
if(k1!=0)
{delay1ms(100);
if(k1!=0)
{delay1ms(100);
if(k1=0)
{delay1ms(300);
i=0;
}
}
}
}
}
}
return n;
}
我写了一个用数码管显示时间的程序~~ 但是有一个错误搞不掉 P0=s1[q1]; 这个地方。。。subscript on non-array or too many dimensions 老提示这个 因为字数超限 我删掉了一些程序只留下我自己定义函数的部分。。 请帮帮忙把 展开
unsigned char code s2[8]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};
sbit SCLK=P3^0;
sbit DATA=P3^1;
sbit RST=P3^2;
sbit k1=P3^3;
sbit k2=P3^4;
void delaynus(int n)
void fun(cmd,s1,s2,i)
unsigned char cmd,s1[10],s2[8],i ;
{
int a1,a2;
unsigned char a;
a=readset(cmd);
a1=a%10;
a2=a/10%10;
P0=s1[a1];
P1=s2[i++];
delay1ms(20);
P0=s1[a2];
P1=s2[i];
delay1ms(20);
}
void fun2(cmd,s1,s2,i)
unsigned char cmd,s1[10],s2[8],i ;
{
int a1,a2;
unsigned char a;
a=readset(cmd);
a1=a%10;
a2=a/10%10;
P0=s1[a1];
P2=s2[i++];
delay1ms(20);
P0=s1[a2];
P2=s2[i];
delay1ms(20);
}
void nian(s1,s2,i)
unsigned char s1[10],s2[8],i;
{
int a1,a2,a3,a4;
unsigned char a;
a=readset(0X8c);
a1=a%10;
a2=a/10%10;
a3=a/100%10;
a4=a/1000%10;
P0=s1[a1];P2=s2[i++];
delay1ms(20);
P0=s1[a2];P2=s2[i++];
delay1ms(20);
P0=s1[a3];P2=s2[i++];
delay1ms(20);
P0=s1[a4];P2=s2[i++];
delay1ms(20);
}
void xs(s1,s2,q,i)
unsigned char s1,s2;
int q,i;
{
int q1,q2;
q1=q%10;
q2=q/10%10;
P0=s1[q1];
P1=s2[i++];
delay1ms(20);
P0=s1[q2];
P1=s2[i++];
delay1ms(20);
}
void xs2(s1,s2,q,i)
unsigned char s1,s2;
int q,i;
{
int q1,q2,q3,q4;
q1=q%10;
q2=q/10%10;
q3=q/100%10;
q4=q/1000%10;
P0=s1[q1];P2=s2[i++];
delay1ms(20);
P0=s1[q2];P2=s2[i++];
delay1ms(20);
P0=s1[q3];P2=s2[i++];
delay1ms(20);
P0=s1[q4];P2=s2[i++];
delay1ms(20);
}
void zhou(s1)
unsigned char s1;
{
int b;
b=readset(0X8a);
P0=s1[b];
P2=0Xbf;
}
int sad(void)
{
int i=1,n=0;
while(i)
{
if(k1==0)
delay1ms(20);
if(k1==0)
n++;
if(n>8)
n=1;
if(k1!=0)
{
delay1ms(100);
if(k1!=0)
{delay1ms(100);
if(k1!=0)
{delay1ms(100);
if(k1!=0)
{delay1ms(100);
if(k1=0)
{delay1ms(300);
i=0;
}
}
}
}
}
}
return n;
}
我写了一个用数码管显示时间的程序~~ 但是有一个错误搞不掉 P0=s1[q1]; 这个地方。。。subscript on non-array or too many dimensions 老提示这个 因为字数超限 我删掉了一些程序只留下我自己定义函数的部分。。 请帮帮忙把 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询