¿Cómo utilizar el microcontrolador 51 y la matriz LED8*8 para mostrar caracteres chinos?
8*8 también puede mostrar caracteres, pero es más difícil mostrar caracteres chinos.
#includelt;reg51.hgt;
#includelt;intrins.hgt;
#define uchar unsigned char
#define uint código int sin firmar
uchar Table_of_Digits[]=
{
0x00, 0x3e, 0x41, 0x41, 0x41, 0x3e, 0x00, 0x00, //0
0x00, 0x00, 0x00, 0x21, 0x7f, 0x01, 0x00, 0x00, //1
0x00, 0x27, 0x45, 0x45, 0x45, 0x39, 0x00, 0x00, // 2
0x00, 0x22, 0x49, 0x49, 0x49, 0x36, 0x00, 0x00, //3
0x00, 0x0c, 0x14, 0x24, 0x7f, 0x04, 0x00, 0x00, //4
0x00, 0x72, 0x51, 0x51, 0x51, 0x4e, 0x00, 0x00, //5
0x00, 0x3e, 0x49, 0x49, 0x49, 0x26, 0x00, 0x00, //6
0x00, 0x40, 0x40, 0x40, 0x4f, 0x70, 0x00, 0x00, //7
0x00, 0x36, 0x49, 0x49, 0x49, 0x36, 0x00, 0x00, //8
0x00, 0x32, 0x49, 0x49, 0x49, 0x3e, 0x00, 0x00, //9
0xff, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0xff
};
código uchar xdat[8]={0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01};
uchar code ydat[8]={0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80}
uchar i=0, j=0, t=0, Num_Index, clave, xi, yi;
sbit we1=P1^1;
sbit we2=P1^3;
//Programa principal
void main()
{
//P1=0x80;
Num_Index=0; //Comenzar a mostrar desde 0
TMOD=0x01; //modo T0 0
TH0=(65536-2000)/256; //temporización de 2 ms
TL0=(65536-2000)256;
IE=0x82;
clave=0;
xi=0;
yi=0;
EX0= 1;
IT0=1;
TR0=1; //Iniciar T0
mientras(1);
} p>
//Función de interrupción T0
void ext_int0() interrupción 0
{
key ;
keyamp;= 0x03;
}
void LED_Screen_Display() interrupción 1
<p>{
TH0=(65536-2000)/256; //temporización de 2 ms
TL0=(65536-2000)256;
interruptor(tecla )
{
caso 0:
P0=0xff;
we1=1;
P0= ~Table_of_Digits[Num_Index*8 i];
we1=0;
P0=0xff; // Salida de código de bits y código de segmento
we2=1;
P0=xdat[i];
we2=0;
if( i==8) i=0; está representado por Compuesto por 8 bytes
if( t==250) //Cada número se actualiza y se muestra durante un período de tiempo
{
t =0;
if( Num_Index==10) Num_Index=0; //Mostrar el siguiente número
}
break;
caso 1:
p>we1=1;
P0=~xdat[xi];
we1=0;
we2=1;
P0=ydat[yi];
we2=0;
if(t==250) //Cada número se actualiza y mostrado durante un período de tiempo
{
t=0;
yi;
if(yigt;7){yi= 0;xi;}
if(xigt;7)xi=0;
}
romper;
caso 2:
we1=1;
p>
P0=0x00;
we1=0;
P0=0xff; // Código de bits de salida y código de segmento
we2=1
P0=xdat[i]
we2=0; ( t==250) //Cada número se actualiza y se muestra durante un período de tiempo
p>
{
if( i==8) i=0; //Un número en cada pantalla consta de 8 bytes
t=0;
}
break
default: p>
clave=0;
i=0;
j=0; =0;
yi=0;
Num_Index=0;
we1=1; >
nosotros1=0;
nosotros2=1;
P1=0x80;
nosotros2=0;
romper;
}
}