From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

receiving serial commands from microcontroller to serial port of PC with LabVIEW

Hi all,

 

I am developing an application where i need to interface serial port of PC with Labview and a microcontroller. I need to receive and transmit serial commands to microcontroller in a packet format(The packet of 5 bytes that includes header, data length, id, data and checksum). 

 

I have successfully tested the VISA serial read vi and serial write vi for Tx and Rx 1 byte data , but have no idea of handling packet format where i also need to validate the  packet data received. 

 

Kindly provide me any suggestions.

 

with regards,

Sri

0 Kudos
Message 1 of 2
(3,923 Views)
You've got the first step. As you receive each single byte, see if it's the header. Once the header is found, read 4 bytes. After that, you are synched and each read would be 5 bytes. The string to bye array function would then be used and you can index any element you want.
0 Kudos
Message 2 of 2
(3,916 Views)