这个码是关于静态数码管的表示的
#include <REGX52.H>
unsigned char G[lbk][rbk]={0x3f,0x06,0x4f,0x66,0x6d,0x7d,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71,0x00}
void z(unsigned char x,y)
{
switch(x)
{
case 1:P2_2=0;P2_3=0;P2_4=0;break;
case 2:P2_2=1;P2_3=0;P2_4=0;break;
case 3:P2_2=0;P2_3=1;P2_4=0;break;
case 4:P2_2=1;P2_3=1;P2_4=0;break;
case 5:P2_2=0;P2_3=0;P2_4=1;break;
case 6:P2_2=1;P2_3=0;P2_4=1;break;
case 7:P2_2=0;P2_3=1;P2_4=1;break;
case 8:P2_2=1;P2_3=1;P2_4=1;break;
}
P0=G[lbk]y[rbk];
}
void main()
{
z (2,1);
undefined
}
谢谢🙏
#include <REGX52.H>
unsigned char G[lbk][rbk]={0x3f,0x06,0x4f,0x66,0x6d,0x7d,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71,0x00}
void z(unsigned char x,y)
{
switch(x)
{
case 1:P2_2=0;P2_3=0;P2_4=0;break;
case 2:P2_2=1;P2_3=0;P2_4=0;break;
case 3:P2_2=0;P2_3=1;P2_4=0;break;
case 4:P2_2=1;P2_3=1;P2_4=0;break;
case 5:P2_2=0;P2_3=0;P2_4=1;break;
case 6:P2_2=1;P2_3=0;P2_4=1;break;
case 7:P2_2=0;P2_3=1;P2_4=1;break;
case 8:P2_2=1;P2_3=1;P2_4=1;break;
}
P0=G[lbk]y[rbk];
}
void main()
{
z (2,1);
undefined
}
谢谢🙏