I am writing code for a microprocessor to communicate with an external device via asynchronous serial communication over a single wire.
I can recognize the transition to wire from low / high (anyway), so I can find the boundaries of the bits. Given that I know the baud rate that the device is using, I can start to synchronize the bits, so I can read the bit stream coming from the device.
What I am afraid of conceptually is recognition of a start bit - search for the beginning of a byte frame (provided that I get 8 bits, without parity, 1 start bit, 1 stop bit). I understand that every frame starts with a start bit and ends with a stop bit, but I understand that the start and stop bit looks like any other bits, so there is nothing special in that they identify them as start or stop bits (except for their position )
The only way I can determine the start bit is the first high bit after a long period of inactivity - that is, since I expect 8 bits to have no parity, if I get 9 or lower bits, then the line is idle, and the next most significant bit will be the start. This is all fine, but what if I start listening to a mid-bitstream device and there is no downtime of 9 bits or more on the wire? I turn off the bits, but how do I know which bit is the start bit so that I can read the bytes? If I turn off the bits, then everything that is between the frames can only be an integer number of bits (so the βstopβ bit cannot be, for example, 1.5 bits), so everything just looks like bits.
Hope I make sense ... thanks for any help.
Jeffr source share