LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial Device Communication Issues

Hello! I'm having issues communicating with an Omega Model HHF143 Anemometer using LabVIEW.

 

I'm able to run a simple VI that gives me the read buffer, although it is set up to return a specified amount of bytes. I am having issues with using a termination character to "clean" up the data, but I believe that it's necessary for my situation because the number of bytes changes depending on the anemometer readings.

 

For example, setting the bytes to "13" works for readings between 0.00-9.99 m/s, but it changes once it reaches "10.00." There is no documentation (that I can find) for this Omega HHF143 other than the attached PDF that specifies the Baud Rate.

 

I tried setting the input bytes to a large number and enabling a termination character and used A, 10, 13, plus a few of the other options but I could not get the VI to only return one line of data at a time. I used Parallax Serial Terminal to monitor the readings and although there's a slight stutter, it seems like the data is returned one line at a time.

 

 

Any advice or feedback as to what I'm doing wrong? Or is it because the device doesn't have a "termination character" programmed into it? If that's the case, I would appreciate some guidance into how to parse the incoming data and extract one line at a time. I have included screenshots of what happens when I select different input bytes for the Read function and also the VI itself.


Thank you very much!
-F

0 Kudos
Message 1 of 17
(1,846 Views)

In cases like this, it would be awesome if you could attach the manual that shows the communication protocol.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 2 of 17
(1,813 Views)

Can you provide the screen shots? 

RKO
Message 3 of 17
(1,789 Views)

Most serial communication issues can be solved by studying the manual to understand their specific serial protocol and watching this video: VIWeek 2020/Proper way to communicate over serial

========================
=== Engineer Ambiguously ===
========================
Message 4 of 17
(1,773 Views)

Try doing what you did before setting the input bytes to a large number and getting a reading, but put the string control in "Hex display" mode instead of plaintext.  Hopefully you can see something like this:

Kyle97330_0-1680893275448.png

The last character listed in this example is a 09, which is an invisible tab and would be your termination character.

 

Also, you say you tried "used A, 10, 13".  "A" is 10 in hex, so there's a good chance you had the termination character input control set to hex, so if you put "13" in there that was actually ASCII 19.  Did you try "D" which is actually ASCII 13 (carriage return) which is a pretty common termination character?

 

Another alternate plan:  It sounds like you always get the same amount of decimal places (2).  If that's the case and your device truly doesn't have a proper termination character, you could try setting "." as your termination character, then always reading 2 more after that, and concatenating the results.

Message 5 of 17
(1,763 Views)

Oops, I swear I attached the files and VI but they didn't get posted.

 

Here you go!

0 Kudos
Message 6 of 17
(1,757 Views)

Thanks for the video! I'll take a look.


Here's the manual for reference.

0 Kudos
Message 7 of 17
(1,755 Views)

Yeah, I definitely meant to but for some reason the files I attached didn't get uploaded with the post. Here it is, sorry about that!

0 Kudos
Message 8 of 17
(1,754 Views)

Thanks for your reply! I will be trying this out on Monday when I'm back in the lab and I can run the anemometer. You are correct about the two decimals being consistent.

 

I appreciate the alternative solution as well because that seems like it could work if I'm not able to get a proper termination character. It sounds like it could also help me clean up the data in general because the output format is "Air,xx.xx,MPS," so I need to extract the numbers out of the string at some point. (There is indeed a comma after the "S")

0 Kudos
Message 9 of 17
(1,748 Views)

It looks from the manual that the instrument will continuously spit data over serial every second. So you can use the function "bytes at port" that will return the number of bytest at the serial port. Wire that byte number into the Read function.

Every time it executes, it will check the serial buffer, and read the amount of bytes at the port. You will need then to find a way to extract the number from Air, xxx, MPS.

ROtake_1-1681104331095.png

 

 

RKO
0 Kudos
Message 10 of 17
(1,698 Views)