LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview visa problem.

Solved!
Go to solution

Hi,

 

I send 10 byte data every 4ms from MCU(stm32) to PC(labview).

 

The MCU does not send zero value, but my labview visa program output zero frequently(not all data).

 

The uart of MCU is not problem(i check by another serial communication program).

 

Send data is 

0xBE, 0xD7, uint8_t data1, uint8_t data1 data2,uint8_t data3,uint8_t data4, uint8_t data5, uint8_t data6 ,uint8_t data7 ,uint8_t data8

 

The 0XBE and 0xD7 are STX of protocol.

 

I attach my labview program.

 

What is the problem?

0 Kudos
Message 1 of 3
(3,219 Views)
Solution
Accepted by topic author Sangkyu

1. You do not need to wire up all of the index inputs on the Index Array.  The first will default to index 0 and they just add by 1 from there.

2. No need to put a wait in the loop.  The VISA Read will do the waiting for you.

3. Since you are dealing with binary data, turn OFF the termination character on the VISA Configure Serial Port.

4. You can right-click on the case structure and select Radix->Hex to make it a little easier to read.

5. Make sure you have a way to properly stop your VI.  DO NOT USE THE ABORT BUTTON IN THE TOOLBAR!!!  Add a stop button to your front panel and use that.  This way you can properly close down your serial port and file.

6. Since you are just getting 16 bit data, I would use the Unflatten From String with a U16 as the data type.  This will extract your 16-bit data and leave the rest of the string for other parsing.  So you can just use 4 Unflatten From Strings to get your four channels of data.

7. You can do some really cool things with the Format Into String to make it easier to figure out what is going where just by using the Format String.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Download All
Message 2 of 3
(3,197 Views)

It sounds like you are sending binary data, and the way you've structured the reading of your bytes seems to match your data packet description.

 

What I do see is that on you Serial Configure, you have nothing wired into the termination character connections.  That means it will default to True (termination character enabled) and Decimal 10, (termination character is line feed.  So any time your 8 bytes of data would contain a decimal value of 10 as one of the bytes, that VISA read will end before you've read all 8 bytes.

 

Wire a False Constant into the "Enable Termination Char (T)" input for the serial configure.

0 Kudos
Message 3 of 3
(3,192 Views)