LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Weird characters received from instrument using serial communication in labview

Hi, 

 

I am trying to acquire data from my instrument using labview serial communication but the data I am getting are some weird characters instead of the numeric data I was expecting. Can someone kindly help me out with how I can resolve this? The vi I am using is attached together with the characters I am receiving.

 

Thanks.

Download All
0 Kudos
Message 1 of 33
(938 Views)

Obviously this is binary data so you need to know the details of the response in order to cast it correctly (datatypes, endian-ness, etc.).

 

Do you have the manual for the instrument?

 

(For some ideas, have a look here. Of course you would need to make significant modifications for your scenario)

 

(Sorry, I cannot look at your VI. Only LabVIEW 2020 here).

0 Kudos
Message 2 of 33
(912 Views)

Some (what I hope is helpful) comments:

  1. I (and many other "long-time experienced LabVIEW users", many of whom do not install the "latest version", particularly with the new more-expensive cost of buying every version annually) cannot open your LabVIEW 2023 VI.  If you want more LabVIEW experts to be able to comment on your code, you need to "Save for Previous Version" and use a version such as LabVIEW 2019 or LabVIEW 2021 (both of which I have on this laptop I'm using).,
  2. If you had told us more about the mysterious "instrument", including its name, model, etc., the curious among us (or, even better, the "experienced users" of said instrument) would surely have good advice for you.  Maybe the problem is that it uses some very strange and secretive communication protocol, in which all the bytes being sent are shifted two bits to the right for "security" (I'm making this up ...).  But we could, at least, read the manual ourselves and maybe make some very direct and hopefully helpful comments.
  3. I'm assuming you are using Serial Communication (because it is in your title!).  I assume you are using VISA to do this, probably over a USB cable.  Do you know about setting up VISA?  Baud Rate?  Bits (7 or 8)?  Parity?  Do you know what parameters your device uses?  Do you know how to set up your VISA code (which I can't see, as per Point 1 above) and what your "instrument" wants (see Point 2), do you know about plugging your device into your PC, opening up MAX, find the appropriate VISA Port, and set up VISA to try to communicate with your device?  You "make a guess" (or follow the suggestions in the User Manual) for the VISA Protocols on your PC, then try sending a "Who are you?" message to the "instrument".  I haven't used serial communication recently, but I remember something like "IDN*" (or something like that) as a command that gets many Instruments to respond with their name, parameters, etc.  So you try something like that, and when you get garbage back (or nothing back), you try another setting.  If you are "close", maybe you need to change from 7-bit to 8-bit, or Even to Odd parity.
  4. When all else fails, are there knowledgeable CS or EE students in your vicinity?  Colleagues who have experience with communication protocols?

Feel free to provide more useful information.

 

Bob Schor

0 Kudos
Message 3 of 33
(902 Views)

What device are you trying to communicate with?  Unless we know what the data is supposed to be, we cannot help you properly read the data.  At the moment, the best I can do is give you this resource: VIWeek 2020/Proper way to communicate over serial


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
0 Kudos
Message 4 of 33
(845 Views)

The device is current, voltage, temperature controller for Horizon H-1000 PEM fuel cell stack. Unfortunately, I do not have a manual for it just a document on how to communicate with the manufacturer's software which I have attached.

0 Kudos
Message 5 of 33
(831 Views)

Obviously, they provide a LabVIEW executable, which is of no help. (I assume that they remove the diagram).

 

Can you run your original program and receive some data to display in a string indicator. Then stop the VI and create a constant from that indicator terminal (right-click...create constant). Now we have a sample of typical data to play with. Save the VI under a new name and attach it here (LabVIEW 2020 or below).

 

Also provide any other relevant information on what kind of data you expect (how many values, typical data range, etc.)

Can we assume that the communication settings are correct?

0 Kudos
Message 6 of 33
(813 Views)

Uhm, I have no access to the block diagram of the original program, just the front panel which does not also open in labVIEW so I am not sure how I can create the constant to the indicator terminal. I have attached a sample of the data that I receive using the original monitoring software. 

0 Kudos
Message 7 of 33
(792 Views)

An excel file of the parsed data is useless to troubleshoot the problem. Since most bytes are non-printable characters, a picture does note tell the story. can you attach that text file?

 

We need the data you get here:

 

response_snippet

 

0 Kudos
Message 8 of 33
(787 Views)

In the original program there is no display like that just the displays here. Once I end the program, it just saves to the excel file. 

aj_as_0-1704999706490.png

 

0 Kudos
Message 9 of 33
(777 Views)

Try running this updated VI.  I made it so the read data is saved directly to a text file.  We are looking for any hints at what the data frame is.


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
0 Kudos
Message 10 of 33
(770 Views)