Red de conocimiento informático - Problemas con los teléfonos móviles - Programación Tz

Programación Tz

#include ltreg 51.h gt;

#Definir carácter sin firmar uchar

código uchar ledtab[]={0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x07, 0x7f, 0x6f}; //0-9

Carácter sin firmar seg=0, min=0, hora=12, escaneado

Clave de carácter sin firmar, flashbit, punto, hora, tiempos = 0; tflash?

Carácter sin firmar disdat[4];

sbit keyqt=p3^0;

sbit keyxz=p3^1;

sbit keytz=p3^2;

Discusión no válida()

{

disdat[0]= min 10;

disdat[ 1 ]= min/10;

disdat[2]=hora 10;

disdat[3]=hora/10;

}

Void T0ISR() interrumpe el temporizador de 1//segundo

{

TR0 = 0;

TH0 = 0x3c

TL0 = 0xb0

TR0 = 1;

tiempo

si (tiempo lt10)punto = 0

si no punto = 1 ;

si (tiempo==20)

{

tiempo = 0;

seg ;

si( seg gt59)

{

seg = 0

min ;

if(min gt;59)

{

hora;

si (hora gt23) hora = 0;

}

}

}

dischg();

}

Vid t1ISR() interrupción 3//display

{

tr 1 = 0;

th 1 = 0x EC;

TL 1 = 0x 78;

tr 1 = 1;

veces;

if (veces gt; = 50) {número de veces = 0; tflash = ~ tflash}

Interruptor (led de escaneo)

{

Caso 0:

P2 = 0x 01;

P0 = ~ pestaña led[disdat[3]];

si ((t flash == 0) amp; amp(flash bit == 1))P0 = ~ pestaña led[0x 10];

Rotura;

Caso 1: p>

P2 = 0x 02;

if(punto)P0 = ~(ledtab[disdat[2]]| 0x 80);

si no P0 = ~ ledtab[ disdat[2]];

if((t flash = = 0) amp; amp(flash bit = = 1))P0 = ~ led tab[0x 10];

Rotura;

Caso 2:

P2 = 0x 04;

P0 = ~ pestaña led[disdat[1]];

if((t flash == 0) amp; amp(flash bit == 2))P0 = ~ pestaña led[0x 10];

Rotura;

Caso 3:

P2 = 0x 08;

P0 = ~ led tab[disdat[0]];

if((t flash = = 0) amp; amp(flash bit = = 2))P0 = ~ pestaña led[0x 10];

Romper;

Predeterminado: descanso

}

led de escaneo;

escaneado = 4; ()

{

TMOD = 0x 11;

TH0 = 0x3c

TL0 = 0xb0

th 1 = 0x CE;

TL 1 = 0x 78;

EA = 1;

tr 1 = 1

ET0; 1;

et 1 = 1;

seg = 0;

min = 0;

horas = 0;

bit de flash = 0;

led de escaneo = 0;

Tiempo = 0;

t flash = 0; >punto = 1;

dischg();

mientras(1)

{

//flash();// Intermitente

If (keyqt = = 0)//p3.0 iniciar y detener

{

while (key Qt = = 0);

TR0 = ~ TR0

bit de flash = 0;

}

Si (keyxz = = 0)//p3.1, seleccione el tiempo y minutos.

{

mientras(clave xz = = 0);

TR0 = 0;

bit de flash;

if(flash bit gt; 2){ flash bit = 0 TR0 = 1;}

}

if(keytz = = 0)//número de modulación

{

mientras(clave tz = = 0);

if(flashbit==1)

{

hora;

if (hora gt23) hora = 0;

}

if (flashbit==2)

{

min;

if(min gt;59)min = 0;

}

dischg();

}

}

}