#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8)
char cdna[2];
int cont=0,indice=0;
int num;
int1 datolisto;
#int_rda
void rda_isr(void)
{
cdna
[indice
]=getch() - 0x30; if(cdna[indice] < 9)
{
// Solo aumento si lo que llego es un dato valido
indice++;
}
if(indice == 2 )
{
indice = 0;
datolisto = true;
}
}
void main()
{
output_b(0);
output_d(0);
enable_interrupts(int_rda);
enable_interrupts(global);
while(TRUE)
{
if ( datolisto == true )
{
datolisto = false;
num = cdna[0] * 10 + cdna[1];
switch (num)
{
case 0:
output_b(0);
break;
case 1:
output_b(0b00000001);
break;
default:
break;
}
}
}