# Reading serial data with 10 bits per transfer

Hi there, I am trying to read a serial data stream with arduino of which the exact settings I do not know. I have used my logic annalyser and managed to determine settings which lead to no framing errors and all the data showing up fine. These are as follows:
728 bit/s , 10 bits per transfer , 1 stop bit , no parity ,non inverted.
How can I read the 10 bits per transfer into the arduino?

At that data rate, you will have to perform some kind of timing measurements to determine where the middle of a bit is after the start bit (so 12 bits total?) and capture the High or Low at that point. I imagine the various Software Serial libraries do the same thing. Check out the code behind them, basically:
728 bits/Second is 1/728 second wide bits, or 1374uS. micros() can only do 4uS intervals, you can use 1372 and 1376 to kind of wobble around the middle of the bits without drifting too far away from the middle over the 10-12 bit interval. For example, after detecting the start of a start bit, wait 1.5 x 1372uS and capture the high/low there as bit 0, then 1376uS later bit 1, 1372 to the next middle, 1376 to the 4th bit, etc. until you have all 10 bits. Wait for the stop bit, then wait for the next start bit and start again.
I suppose just drifting 40uS away from the middle over 1374uS would be good enough also if you just wanted to use 1 number.
Put the 10 bits into an unsigned int, and process them however you're going to process them.

I guess you could modify my Yet Another Software Serial to do what you want.

It would help if you told us about your project - what is sending the data, why is it in a strange format etc. At the moment it has all the hallmarks of an XY problem

...R

I'm pretty sure that none of the Arduino hardware supports reading 10bit serial characters, although you might be able to fake it using the 9bit character support plus fiddling with the parity on a per-character basis. At the data rates you are talking about, some sort of software serial implementation probably makes a lot more sense.

Robin2:
what is sending the data