LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

why recieved data is mess up?

I use this vi to get data from serial port (COM3), why does the recieved data look like mess up? please see attached screen shoot, read string in the buffer shown in pink box"k...j...", also in front panel, read string shows the same.

 

my data aquire system is set up in this way, datalogger connect to PC COM1 by 9-pin wire, and  recieve data pin(#2) and Signal Ground pin (#5)of COM1 are connected to the same pin of COM3, and labview get data from COM3 port.

 

thanks very much.

 

string error.JPGfront panel 1.JPG

0 Kudos
Message 1 of 5
(2,685 Views)

How do you know it's "messed up"? Are you expecting some readable text? You're issuing an IDN command, so presumably the answer is yes? Usually when you get stuff like that it implies your comm settings don't match the settings for whatever you're talking to. Or, the data you're getting is actually a byte stream. What does the documentation for the device you're talking to indicate? What device are you talking to?

 

Your comm configuration is also confusing. You've set it up so that reads terminate on the character with ASCII code of 42, which is "+". But in the code you are reading a fixed number of bytes. Are you sure this is right? Doesn't seem right to me. Which is it that you're supposed to be doing? Reading until you see a specific character, or reading a known number of bytes for the response?

0 Kudos
Message 2 of 5
(2,674 Views)

I aggre that you are either seeing valid data that is in binary and you need to interpret it or your setting (general the BAUD rate) is mismatched with the devide.

 

You may also want to consider converting your stacked sequence into a state machine. State machines are much easier to work with and are easier to maintain. Stacked sequences should be avoided as they are a poor choice of a programming construct in LabVIEW.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 3 of 5
(2,651 Views)

Even after you attend to the items mentioned by Saverio and Mark, the flow control will not work since port 3 does not talk to the widget. Non-functioning flow control can result in bogus data.

 

It sounds like you are trying to eaves drop on another software package. I wrote about that in my "Measuring the Diameter of a Pretzel" paper.

 

In a nut-shell

 

Port 3 should sit between com1 and the widget and should echo both transmit and recieve to from com1 one and the widget.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 4 of 5
(2,629 Views)

thanks for your help.

 

its my first time to use labview, so new to me, I even donot know where I should start to learn, I just try to make labview program run and get experiment data, my boss is pushing me 😄

 

you are right, the mess up actually turns out to be good data. but what I am confused is that labview file looks like recvieved different data or string sometimes.

 

most time, it recieved data in a repeat pattern which start with 'C', like

 

"C

.........

C

.........

"

 sometimes, it recieved data with start of 'K', like

"K

%^$#@#

K

$%@^@#$

 

"

 

actually, this K string is good data, front panel shows right data I want, temperature, pressure,etc. I almost have little knowledge in this area, but would like to start to learn,

 

0 Kudos
Message 5 of 5
(2,610 Views)