
temp_bit = count_bit_time(1); //count the transmission time for bit '1'

unsigned int count_bit_time( bit digit)    /* digit==1*/
{
        ...
        RXD = 1;                /* configure as an input pin */
        ...
        RXD = ~digit;           /* pull RXD low so nothing can make it high anymore */
        ...
        while (RXD != digit);   /* wait until stronger hardware destroys this pin by pulling it high */
        ...
        while (RXD == digit);   /* hopefully never reached */
        ...
}