LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

easy way to get error error from U16 to Ring conversation?

What is the eas

Vasilich2004_0-1714973654394.png

 

0 Kudos
Message 1 of 19
(391 Views)

Hi Vasilich,

 


@Vasilich2004 wrote:

What is the easy way to get error error from U16 to Ring conversation?


I don't see any error. All I see is the expected result of this conversion!

 

You could use property nodes of the ring to reads the currently defined items and compare their values with your input value "12"…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 19
(373 Views)

The Ring is a LabVIEW-internally-handled list of integer-text assigns. So the Ring-indicator shows the apprpriate text entry when fed with a defined value. If the value is not defined, LabVIEW shows an <integer value> entry. This is expected behaviour.

The property node Gerd mentioned is the "Values[]" property, there you can check with "Search 1D Array" the presence of your integer value.

 

P.S. You don't need the typecasts, just connect the U16 constant with the indicator, LabVIEW will do the coercion for you.

Greets, Dave
0 Kudos
Message 3 of 19
(365 Views)

Thank you, GerW and daveTW, for quick answers.

I think the easiest way would be string comparision:

Vasilich2004_0-1715011392391.png

In anyhow, convertation U16 into List (as well as Enum) has good chance to get hidden error. Unfortunately, it isn't possible to write single vi to check conversation of different Lists. Am I correct?

 

Additionally, one way out of 3 ways which I used in first message gave wrong result. I used U8 and answer was <3712> instead of <12>. It means one way doesn't convert U8 into U16 before convertation.

0 Kudos
Message 4 of 19
(314 Views)

Hi Vasilich,

 

why do you use the current ring text for comparison?

You can read the defined items (values and strings) and compare with them!

No need to convert to string, no need to add additional chars (<>):

(Getting the ring Strings&Values should be a one-time operation…)

 


@Vasilich2004 wrote:

Additionally, one way out of 3 ways which I used in first message gave wrong result. I used U8 and answer was <3712> instead of <12>. It means one way doesn't convert U8 into U16 before convertation.


In your first message all 3 results are the same…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 19
(291 Views)

Hi GerdW,

I think Loop should take long time.

At the beginning, I copied-pasted and value was U8. When I changed to U16 then error conversation disappeared.

0 Kudos
Message 6 of 19
(279 Views)

Hi Vasilich,

 


@Vasilich2004 wrote:

Hi GerdW, I think Loop should take long time.


That's why I mentioned that reading the property node should be a one-time operation, so the loop reduces to an ArraySearch function…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 19
(244 Views)

@Vasilich2004 wrote:

Hi GerdW,

I think Loop should take long time.

At the beginning, I copied-pasted and value was U8. When I changed to U16 then error conversation disappeared.


Compared to what? It does take _some_ time, but unless you do it very often (it would only be needed at Value Change) it should be miniscule.

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 8 of 19
(227 Views)

Hi GerdW!

"That's why I mentioned that reading the property node should be a one-time operation, so the loop reduces to an ArraySearch function…"

 

Could you, please, show how you plan to use ArraySearch function?

As I see it will require another loop to create array of values.

 

0 Kudos
Message 9 of 19
(195 Views)

Hi Vasilich,

 


@Vasilich2004 wrote:

Could you, please, show how you plan to use ArraySearch function?

As I see it will require another loop to create array of values.


Example:

As your ring is type-defined you surely know all the expected items in the ring at program start…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 10 of 19
(181 Views)