LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem in receiving serial data!

Hi,

I am sending 12bit data from my PSOC micro controller with baud rata
19.2kbps

But i am not able to receive the 12 bits in labVIEW. Because i am not
able to configure labVIEW for receiving 12 bits (option available is
bytes!).

How do i get my 12 bits of data back?

If i am configuring for receiving 3bytes of data i am able to extract
the correct data bits. Because it is of 24 bits, right!

Thanks.


Regards,
Muthu
0 Kudos
Message 1 of 3
(3,435 Views)
UART-based communication (computer COM ports) are formatted as 1 bit of start, 5-8 bits of data, an optional parity bit, and 1-2 bits of stop. If you wish to transmit 12 bits of data, you'll need to send it as 2 frames (6 bits each) and then reassemble (extract the data). However you'll need to verify that the micro is formatting the data correctly (with start and stop bits).
Message 2 of 3
(3,435 Views)
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.


LabVIEW, C'est LabVIEW

Message 3 of 3
(3,435 Views)