12-21-2011 04:21 AM
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 ), 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.
12-21-2011 06:02 AM
12-21-2011 06:18 AM
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.
12-21-2011 06:19 AM
Could this be a LabVIEW version difference? I am using 8.6.
B.
12-21-2011 06:23 AM - edited 12-21-2011 06:23 AM
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...
12-21-2011 09:24 AM
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
12-21-2011 01:32 PM
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.
12-22-2011 03:53 AM
Wow, I love this forum !
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.
12-22-2011 09:15 AM - edited 12-22-2011 10:06 AM
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?