LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to have a dial which allows high precision fixed values?

OK, I need to have two dials.  Both have only specific values allowed.

 

On allows values in a certain range, with increments of 0.25.  That is, I want to allow 7.25 and 7.5, but not, for example, 7.3. 

 

I did this successfully by choosing an increment of 0.25 in the Data Entry tab of the properties, and setting it to coerce.

 

My second dial needs values in a certain range (0 to 359.912109,  if you must know Smiley Happy), with an increment of

0.087890625  (exactly).  When I enter this, it gets rounded off to 0.0879, which will not give me the values that I want.

 

What can I do?

 

Thank you.

B.

0 Kudos
Message 1 of 9
(2,707 Views)

Hi B,

 

just set range and increment in the dial properties. Then set the display properties for your "number indicator" to display 9 decimal chars after the separator...

Best regards,
GerdW


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

I did "just" set range and increment.  The increment is the problem.  I put in

0.087890625 and as soon as the focus leaves that edit control it is changed to 0.0879

 

I don't see where you mean to set the number of digits after the decimal point -- in Display format my options are:

digits

precision type

Hide trailing zeroes

Exponent in multiples of 3

Use minimum field with (which comes with padding options)

 

None of them seem to let me set the number of digits after the decimal point.

If I do manage to do that, will it make the increment edit box work right too, or just the display?

 

B.

0 Kudos
Message 3 of 9
(2,699 Views)

Could this be a LabVIEW version difference?  I am using 8.6.

B.

0 Kudos
Message 4 of 9
(2,697 Views)

Hi B,

 

ahh, now I see what you mean.

It's just a matter of that display, the value used for increment is still "0.087890625"! The values shown in the Range properties dialog are displayed using "%.4f" format...

 

If you're worried about that you still have the option to use property nodes to set the value range for that control - or to read the current settings back to check them...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 5 of 9
(2,696 Views)

B.,

 

You will probably be OK with the value you are using because it has a finite binary representation = 45/512.  In general setting the increment to a fraction may result in values which are only approximately what you want due to the way numbers are represented in the computer.

 

If you need increments which are not finitely represented in binary, make the dial an integer data type and calculate the result.  For your case you could make the dial range from 0 to 4095 then multiply by 45 and divide by 512.  The difficulty with this method is getting the dila marks to display as you would like.  You could use a Scale Style which has markers without labels and then place free text adjacent to the markers.

 

Lynn

 

Custom dial.png

Message 6 of 9
(2,674 Views)

You could expand on Lynn's idea and use a fixed point datatype that has 12 decimal bits and make the range 0..1, then multiply the value by 360.

 

 

Message 7 of 9
(2,661 Views)

Wow, I love this forum Smiley Happy!

 

Thank you all for the replies; I am learning things I never knew.

 

GerdW -- you are absolutely right; I checked it and it is working fine.  I actually thought it wasn't when I was checking before (which is what led me to post my question in the first place!) but I must have made a mistake, because it is fine now.

 

Lynn,

Thank you for your explanation of why it works with this number, and why it wouldn't work for some numbers.  In my case, it is kind of an "of course" that it can be represented in binary, because I am trying to make a nice control for a value which is actually represented in 12 bits, with 0.087890625 as the value of the least significant bit.

 

Altenbach,

I am quite interested in this fixed point datatype idea, since it sounds like it might actually be doing what I really want to do.  That is, what I ulitimately need is a value represented in 12 bits, with 0.087890625 as the value of the least significant bit.  But I want a nice control which displays the real value, not the integer representation.  From reading a bit in the help it sounds like the fixed point datatype might be exactly what I need, but....I am having some problems with it.

1.  I can't choose fixed point representation when I have a dial or knob control.  the "FXP" option is disabled.

2.  The help tells me to set the range and desired delta, but they seem to be read only!

3.  Why do you suggest a range of 0..1 and multiply by 360, rather than a range of 0..360 in the first place?

Thank you.

B.

 

 

0 Kudos
Message 8 of 9
(2,640 Views)

BPerlman wrote:

1.  I can't choose fixed point representation when I have a dial or knob control.  the "FXP" option is disabled.

2.  The help tells me to set the range and desired delta, but they seem to be read only!

3.  Why do you suggest a range of 0..1 and multiply by 360, rather than a range of 0..360 in the first place?


 

  1. Interesting. I wasn't aware if this limitation. I guess it only works for simple controls. 😞 (Here's an idea!)
  2. You cannot set the range and delta, they are the results of the "word lenght" and "integer word lenght". These are tightly limited by the underlying binary representation.
  3. In this particular case, you could chose a word lenght of 12 bits and integer word lenght of zero bits, giving you an increment of exactly 1/4096 (The display is unfortunately rounded to four decimal digits and does not show the full resolution) (Here's another idea!)
Message 9 of 9
(2,633 Views)