Receive-Block inner Timer-ISR:
Code:
if (bRxFlag & RX_M_RECEIVE) // receive ?
{
if (bRxCount == 9) // is this the stop-Bit (9th)
{
bRxFlag &= ~RX_M_RECEIVE; // receiving sequence done
bRxFlag |= RX_M_DATA; // signal data
GICR |= 1<<INT0; // re-enable int0 for next
}
else
{
bRxByte >>= 1; // Shift right data
/* if(PIND&(1<<PD2)) set bit or leave it
{
bRxByte |=0x80;
bRxCount++;
} */
while-Schleife:
Code:
while(1)
{
if(bRxFlag & RX_M_RECEIVE)
{
if(PIND&(1<<PD2))
{
PORTD |=(1<<PD4);
bRxByte |=0x80;
bRxCount++;
}
else
{
PORTD &= ~(1<<PD4);
}
}
}
Lesezeichen