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.
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.
04-28-2020 01:21 AM
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).
Has anyone experienced something like this before?
Greetings,
Phillip
04-28-2020 01:25 AM - edited 04-28-2020 01:32 AM
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:
04-28-2020 02:06 AM
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
04-28-2020 05:49 AM
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)
- …
04-28-2020 08:11 AM
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
04-28-2020 08:36 AM
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.
04-29-2020 03:05 AM
All right, fair point 😂
I will try to better myself👌