LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Entering hex values for Case Selectors

Hello,
 
   How do I enter in Hex values and or decimal numbers for Case Selectors in a Case structure? When I use the backslash char "\" followed by the decima value or try using try using the hex syntax such as 0X78, I keep getting characters. So depending upon the byte I enter the corresponding byte value can be unrecognizable.
  Any ideas out there?
 
 
Regards,


Kaspar
0 Kudos
Message 1 of 8
(6,960 Views)
You can set the radix of the case structure. Right-click on the case and select "Radix->Hex". This will allow you to enter the numerical value in hex format. Works as far back as 7.1. Don't know about earlier.
Message 2 of 8
(6,940 Views)

Hello,

    I have "right clicked" everywhere on the case block and was not able to find a way to change the radix. I am suspecting that because the case selector is a string that I cannot change the radix to a hex or numerical value.

 

Regards,


Kaspar
0 Kudos
Message 3 of 8
(6,904 Views)
Hi Kaspar,

you can convert your string back to number (like 'convert to U8 array'). Then you can create cases using the radix...

The more information you give the better the answers are 🙂

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 8
(6,897 Views)

Hi.

I met the same problem in my project.I followed that way,and it did work.

There is a tip that have to be noticed.That is when you entering hex values for Case Selector,the selector think the input data as the decimal data.So what you have to do is change the converted data to the original data(hex values).

thanks!

LabVIEW 7.1 on XP

0 Kudos
Message 5 of 8
(6,754 Views)


@WangX wrote:
There is a tip that have to be noticed.That is when you entering hex values for Case Selector,the selector think the input data as the decimal data.

Sorry, I do not understand your tip.

How do you wire "hex values" to a case selector? Are you talking about integers? Binary strings? Formatted strings?


@WangX wrote:
So what you have to do is change the converted data to the original data(hex values).

What is "converted data"? What is "original data?" What do you use to "convert"?

You should attach an image or VI to make it clear what you actually mean. 🙂

0 Kudos
Message 6 of 8
(6,741 Views)

Hi,altenbach

I am not good at english,sorry about that.

I will try to make it more clearly.


altenbach wrote:
How do you wire "hex values" to a case selector? Are you talking about integers? Binary strings? Formatted strings?


"wire hex values to a case selector" actually means connecting a hex data with a case selector. And that is a integer.

 

"1.GIF" shows that how does the case selector receive data from "Message". And of course, the type of "Message" is Hex.

The value is "8701". However, the radix of this case is "Decimal". So, this case is not gotta to work correctly.

 

In "2.GIF", I changed the radix to "Hex". But the selector think of input data(Message) as decimal data. And convert it to Hex automatically.

"8701" ->" x21FD". "8701" actually is not decimal data. So, this case is not gotta to work correctly neither.

 

In order to solve this problem, I changed the value of "x21FD" to "x8701" manually. See "3.GIF". And It works.

Thanks.Smiley Happy

 

Download All
0 Kudos
Message 7 of 8
(6,692 Views)

You seem to confuse the data of the wire. It is a plain 2byte integer. (there is no distinction between hex or decimal, formatting is just a cosmetic property of an indicator connected to the wire and does not change the underlying data).

Again, setting the radix of a case structure is only cosmetic and for convenience.

If the wire contains x21FD it is the same as saying the wire contains d8701 or b0010000111111101, it is just displayed differently. You can either set the case to decimal and enter 8701 or set the case to hex radix and enter 21FD or even set the case to binary radix and enter 10000111111101. It will all match the same way.

If you case matches x8701, it means that your decimal data is actually 34561. Simple as that. 🙂

 

0 Kudos
Message 8 of 8
(6,685 Views)