Red de conocimiento informático - Problemas con los teléfonos móviles - Programación del microcontrolador Stc89c52rc: Presione el botón 1 y el LED1 se iluminará durante 5 segundos. Presione el botón 2 y el LED2 se iluminará durante 5 segundos. Prográmelo con un experto.

Programación del microcontrolador Stc89c52rc: Presione el botón 1 y el LED1 se iluminará durante 5 segundos. Presione el botón 2 y el LED2 se iluminará durante 5 segundos. Prográmelo con un experto.

#includelt;reg51.hgt;

#define?uchar?unsigned?char

sbit?key1=P1^0

sbit?key2=P1^1;

sbit?led1=P1^4;

sbit?led2=P1^5;

uchar?cnt1,cnt2 ;

void?t0isr()?interrupt?1

{

TH0=(65536-50000)/256;

TL0 =(65536-50000)256;

cnt1;

cnt2;

if(cnt1gt;=100)led1=1;

if(cnt2gt;=100)led2=1;

}

main()

{

TMOD=0x01;

TH0=(65536-50000)/256;

TL0=(65536-50000)256;

TR0=1;

ET0=1;

EA=1;

mientras(1)

{

si(clave1==0)

{

mientras(clave1==0);

cnt1=0;

led1=0;

}

si(clave2==0)

{

mientras(clave2==0);

cnt2=0;

led2=0;

}

}

}