UARTs (PC and uC) used to transmit data can be configured  to transmit
5,6,7,8 or possibly 9 bits per transmission. You can't transmit 12
bits in a single operation. Either you set the uC to transmit 12bit
data as 2 packets (2x6bits or 2x8 bits) or you pack 2x12 bits into
3x8bit packets.
The 2x8bits seems to be convenient since you send data with the same
packaging as internally used by the PC and the uC (16bit integers).
You read 2 bytes from the serial port and then typecast the string to
a U16.
3x8 would require a little bit swapping on both ends but would
transmit the data faster if this is important. You read 3 bytes from
the serial port and could typecast it to a U32 and extract 2 U16 with
masking and shifting bits.

Reply via email to