04-11-2011 07:41 AM
OK, the HELP text for the STRINGS AND VALUES property of a RING control says that it wants an I32 for each value:
However, if you CREATE a CONSTANT from that property, you don't get an I32, you get an EXTENDED value:
If you create an indicator from the property, you get an EXTENDED value. But you cannot store anything but an integer in the property.
If you write a 1.234, you'll read back a 1.
Somebody's confused.
Blog for (mostly LabVIEW) programmers: Tips And Tricks
04-11-2011 10:28 AM
What LabVIEW version?
It works correctly on my 8.2. Not sure when it got changed/broken.
04-11-2011 10:31 AM
What is your LabVIEW version?
You can set the representation of the ring to anything (DBL, I32, etc.), and the property node will adapt, however when you create a new constant on it, it will always have EXT. Seems like a bug introduced somewhere after LabVIEW 8.2. Maybe it's intentional?
It makes sense to allow fractional values, it's just the type definition of the created constant/control/indicator seems a bit weird...
If you set the representation to EXT, you'll lose the coercion dot.
In LabVIEW 8.2, we don't create a type definition and things work as exepcted.
@CoastalMaineBird wrote:
If you create an indicator from the property, you get an EXTENDED value. But you cannot store anything but an integer in the property. If you write a 1.234, you'll read back a 1.
Of course you need to set the representation of the ring to a type that supports fractional values.
04-11-2011 10:37 AM
Forgot to mention, this is on LV 2010.0, NOT SP1
Blog for (mostly LabVIEW) programmers: Tips And Tricks
04-11-2011 11:59 AM
Hello,
I do not have this version of LabVIEW, but isn't it like that:
Whenever you create a constant in the Block Diagram, LabVIEW automatically sets the type of constant to its default data format. So, in my version 7.1 the constant is set to Integer32, but you can change it by right-clicking on the constant, then moving the coursor on Representation and chosing the reqired format.
It also automatically changes, when you wire the constant with other objects.
04-11-2011 12:32 PM
in my version 7.1 the constant is set to Integer32, but you can change it by right-clicking on the constant, then moving the coursor on Representation and chosing the reqired format.
Well, you can't do that anymore. Notice in the help window, it says "TypeDef". That's the root of the problem - they make the constant into an array of these typedefs, and you can't change it (oh, sure, I could disconnect from the typedef and then change the representation, but the whole point of CREATE CONSTANT is supposed to be MY convenience).
Blog for (mostly LabVIEW) programmers: Tips And Tricks
04-11-2011 03:57 PM
Hmm ... now I realize, the problem is much bigger than it supposed to be on the first look. I have to admit that I got no idea how to solve this trouble.
04-12-2011 04:37 PM
hmm, so it truncates doubles to integers? I'm going to try a few things with this, will get back to you. In the meantime, is there a specific reason you want to use non-integer values?
04-12-2011 04:41 PM
so it truncates doubles to integers?
Yes. That makes sense, given that the representation of the control is integer.
is there a specific reason you want to use non-integer values?
No, I don't want to use them at all. Which is why I wondered why LV creates them for me.
Blog for (mostly LabVIEW) programmers: Tips And Tricks
04-13-2011 06:10 PM
This is indeed a peculiar behavior. I'm going to look into this to see if it is intentional, and if so, why.