From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Missing bytes when reading IR Pyrometer

Hello everyone,

 

I'm trying to read the temperature values from an IR Pyrometer (B&B Sensors DM501 ML3) with a simple VI. For this i send a read command and should receive 2 Bytes which are converted to temperature from Hex via : (Byte1*256+byte2-1000)/10

 

This works fine except for the temperature range of 156 to 181.7 where only the Hex byte "0A" is received, causing the data to flatline at 156 °C (see appended excel file)

 

I know the device is working fine because the software supplied by B&B sensors can read the temperature correctly (same PC!).

 

When i  use VISA test panel i often get 4 bytes a a response (tho mostly the expected 2 bytes). Those 4 bytes (exept "0A" which is somewhere in the middle) make any sense. In the appended .txt file you can see the visa response for 90 °C and above 156 °C. 

 

Here is my VI. (VISA connection gets configured outside this sub VI with baude rate of 115200).

VI.PNG

 

Has anyone experienced something like this before?

 

Greetings,

Phillip

Download All
0 Kudos
Message 1 of 7
(2,445 Views)

Hi PTimmer,

 


@PTimmer wrote:

This works fine except for the temperature range of 156 to 181.7 where only the Hex byte "0A" is received, causing the data to flatline at 156 °C (see appended excel file) 


You are reading just that $0A byte? Hmm, I wonder if that might relate to the default TermChar being LF (aka $0A byte)!?

 

Suggestion: when opening the serial port using VISASerialPortInit you should DISABLE the TermChar as you have a pure "binary" data protocol!

 

While doing so you really should cleanup your block diagram according to style guide!

You also should use UnflattenFromString to convert that 2-byte string into an U16 value instead of this large Rube-Goldberg convolute:

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 7
(2,440 Views)

Hi Gerd,

 

Thank you for your answer. Disabling the termchar did the Trick 😂🙈

 

regarding your other comment. I am far from a professional programmer and everything i know about labview is self taught. Which as you might guess is quite time intensive as we dont have any labview (or programming in general) experts on site i could ask. So I dont really have the time or patience to worry about stuff like style guides. What is the advantage of doing it your way? Performance?

 

Regards,

Phillip

 

 

0 Kudos
Message 3 of 7
(2,413 Views)

Hi PTimmer,

 


@PTimmer wrote:

So I dont really have the time or patience to worry about stuff like style guides. What is the advantage of doing it your way? Performance?


It's a bad habit not to have this patience! It's a very bad behaviour when you don't even have the patience to use the AutoCleanup button: as long as AutoCleanup improves your code you don't do it right…

 

Advantages:

- clear code is more easily to read/understand

- convoluted/oversized code (like yours) often leads to more buggy code (more code => more bugs)

- UnflattenFromString also has error IO helping you to create more robust code (allowing more error checking/handling)

- …

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 7
(2,382 Views)

idntrllhv thtmrptnc twrr btstfflk vwlsrpncttnrgrmmr...

 

Get the idea?   Yes it takes extra time and patience to use vowels, punctuation, and grammar when communicating, but doesn't it pay off?

 

The point is that messy, carelessly-laid-down code is harder to understand, which in turn makes it harder to debug and makes it easier for bugs to hide.  At least work on keeping wires as straight as possible, and avoid unnecessary wire crossings.

 

 

-Kevin P

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
Message 5 of 7
(2,375 Views)

As others have indicated, doing it the way you're doing it will take more time in the long run as it will be much more difficult to find and fix bugs. Also, if you ever need to add features to code you will find it much simpler. I also began LabVIEW as self-taught but quickly began to develop better style and learn from those who have gone before me.

Message 6 of 7
(2,371 Views)

All right, fair point 😂

I will try to better myself👌

0 Kudos
Message 7 of 7
(2,326 Views)