Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

VCOM Tx Function

Solved!
Go to solution

I build a vcom connection with PC and STM32 MCU.

 

On the MCU, I send alternatively two strings, one is 3 byte long; the other is 5 bite.

DelayMs(20);
UartPutBuffer(&UartUsb, TxBuff.RSSI, 5);
clearBuff(TxBuff.RSSI,5);
DelayMs(20);
UartPutBuffer(&UartUsb, TxBuff.SNR, 3);
clearBuff(TxBuff.SNR,3);

 

On the PC, I write a program with labview, which measure the number generated by property node "bytes at port" to identify string1 and string2.

 

But the problem is that the node "bytes at port" returns three value: 3,5 and 8. How can I avoid the situation of "8 bytes"? 

0 Kudos
Message 1 of 2
(4,481 Views)
Solution
Accepted by topic author SergioMa
Don't use Bytes at Serial Port. A more robust architecture would have you writing a single string with something like a comma separating the values and with a termination character (CR or LF) at the end. Configure VISA to use the same termination character and just use a VISA Read set for some high byte count such as 100. The read will automatically terminate with the read of the termination character. Get the separate values with a Spreadsheet String to Array.
Message 2 of 2
(4,477 Views)