LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Why CREATE CONSTANT creates EXTENDED value?

OK, the HELP text for the STRINGS AND VALUES property of a RING control says that it wants an I32 for each value:

Help 1.png

 

 

However, if you CREATE a CONSTANT from that property, you don't get an I32, you get an EXTENDED value:

 

Help 2.png

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. 

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 1 of 10
(2,681 Views)

What LabVIEW version?

 

It works correctly on my 8.2. Not sure when it got changed/broken.

0 Kudos
Message 2 of 10
(2,663 Views)

What is your LabVIEW version?

 

 

  • In LabVIEW 8.2, you actually get the correct representation, whatever representation you select for the ring.
  • In LabVIW 2010, you get EXT, but I can type any fractional value I want, even in the "edit items" dialog. (sequential values off).

 

 

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.

 

0 Kudos
Message 3 of 10
(2,661 Views)

Forgot to mention, this is on LV 2010.0, NOT SP1

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 4 of 10
(2,656 Views)

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.

 

There was a problem, then there was LabVIEW and now here is the solution !

Marc van Treeck
0 Kudos
Message 5 of 10
(2,632 Views)

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).

 

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 6 of 10
(2,620 Views)

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.

There was a problem, then there was LabVIEW and now here is the solution !

Marc van Treeck
0 Kudos
Message 7 of 10
(2,600 Views)

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?

Product Support Engineer
National Instruments
0 Kudos
Message 8 of 10
(2,572 Views)

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.

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 9 of 10
(2,566 Views)

This is indeed a peculiar behavior. I'm going to look into this to see if it is intentional, and if so, why.

Product Support Engineer
National Instruments
0 Kudos
Message 10 of 10
(2,540 Views)