06-16-2025 01:26 AM
Hi everyone, I'll start by saying that I'm still new to Labview. I'm communicating with a lock in 5210 and I need to display a certain error in Labview. Let me explain better, I send the N command from Labview to the lock in which will return an integer between 0 and 255. This number is the decimal equivalent of a binary number. However, I don't know how to convert this integer and especially how to convert this "error" to display it on the panel. Because, for example, if bit 3 goes to 1 then I should turn on a LED to specify that channel Y is overloaded. I'm attaching the part of the lock in manual and the first part of the (incomplete) Labview code (there is also management of the ?, because if it were to return this character then the command must be resent, and * establishes the end of the number). I hope you can help me.
06-16-2025 01:41 AM
Hi giuli,
@giuli_ wrote:
which will return an integer between 0 and 255. This number is the decimal equivalent of a binary number. However, I don't know how to convert this integer and especially how to convert this "error" to display it on the panel. Because, for example, if bit 3 goes to 1 then I should turn on a LED to specify that channel Y is overloaded.
Simplest approach (for people not used to boolean logic):
When you can apply boolean math rules to your data then you should use the AND function directly on your U8 integer value to mask bit3 (0d08 = 0x08 = 0o010 = 0b00001000)…
06-16-2025 02:03 AM
Ok thank you. So after accumulating the characters (in the while) and after getting the string containing the decimal number, I convert it to a number and then to a boolean array? Right?
06-16-2025 02:32 AM
Hi giuli,
@giuli_ wrote:
Ok thank you. So after accumulating the characters (in the while) and after getting the string containing the decimal number, I convert it to a number and then to a boolean array? Right?
Yes.
Do you really need to send and receive messages with your device on a "one byte after the other" scheme?
06-16-2025 02:53 AM
Thank you so much!!
06-16-2025 11:01 AM
Maybe this is what you are looking for.
06-16-2025 11:54 AM
You are getting a single byte, that has the equivalent decimal value in the range of 0..255. You don't get 1-3 decimal characters (bytes)!
For that reason, you should typecast the single character to U8 and extract the bits
06-16-2025 12:03 PM
06-17-2025 03:16 AM
Thank you!
06-17-2025 06:21 AM
You can simplify the code using a cluster: