|
(pre)
void interrupt ISR(void)
{
if(TMR0IF)
{
time_out1++;
if (!INT0IE)
{
if ((++count_bit1 == 2)&&(Reader_in1)) //Control Start Bit
{
INT0IF = 0;
INT0IE = 1;
}
else if (count_bit1 < 11) // Data Bits
{
byte_read1 = byte_read1>>1;
if (Reader_in1) byte_read1 |= 0x80;
}
else
{
if (Reader_in1) //Control Stop Bit
{
if (count_byte1 > 24) count_byte1 = 24;
buffer_read1[count_byte1++] = byte_read1;
time_out1 = 0;
}
INT0IF = 0;
INT0IE = 1;
}
}
TMR0IF=0;
}
if(TMR2IF)
{
time_out2++;
if (!INT1IE)
{
if ((++count_bit2 == 2)&&(Reader_in2)) //Control Start Bit
{
INT1IF = 0;
INT1IE = 1;
}
else if (count_bit2 < 11) // Data Bits
{
byte_read2 = byte_read2>>1;
if (Reader_in2) byte_read2 |= 0x80;
}
else
{
if (Reader_in2) //Control Stop Bit
{
if (count_byte2 > 24) count_byte2 = 24;
buffer_read2[count_byte2++] = byte_read2;
time_out2 = 0;
}
INT1IF = 0;
INT1IE = 1;
}
}
TMR2IF=0;
}
if((INT0IF)&&(INT0IE))
{
INT0IE = 0;
count_bit1 = 1;
TMR0L = 0x80;
}
if((INT1IF)&&(INT1IE))
{
INT1IE = 0;
count_bit2 = 1;
TMR2 = 0x80;
}
}
(/pre)
E-mail: info@telesys.ru