05-06-2024 12:38 AM
What is the eas
05-06-2024 01:45 AM
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"…
05-06-2024 01:54 AM - edited 05-06-2024 01:56 AM
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.
05-06-2024 11:15 AM
Thank you, GerW and daveTW, for quick answers.
I think the easiest way would be string comparision:
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.
05-06-2024 12:27 PM - edited 05-06-2024 12:28 PM
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…
05-06-2024 01:06 PM
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.
05-07-2024 12:45 AM
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…
05-07-2024 02:47 AM
@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.
05-07-2024 02:50 PM
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.
05-08-2024 01:28 AM - edited 05-08-2024 01:29 AM
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…