Increment the value of the control programmatically, strange result

I have a problem with this VI.
I did it with LV 2009.
There is an auxiliary VI that I use to remove the reference to a control programmatically.
The test.vi (main) tries to set increment to a digital-digital control programmatically.
With the help of the 'heap of ctrl VI', it is possible to do all the code in a single case of big event.

If you change multiplier 'n'--> he grabs value 'n', for N = 1, 2, 3,..., 7
It takes the value of N the multiplier and checks if it is == 1. Then the value increment of the N value accordingly.

Problem:
It does not work as expected.
If you explore the thread, it's all good until the equal check, I don't understand why it does not work.

Thanks for your advice.
Greetings

The problem is probably not full equality of types of data comparison.  As fractions like 0.1 cannot be represented exactly in binary, is often equal to comparisons result in numbers that appear to be equal when displayed with one decimal place are actually different in the 14th, 15th or 16th place.

Use a rough comparison: is the absolute value of the difference of less than 10 ^-14?

Lynn

Tags: NI Software

Similar Questions

  • Numerical simulation of e/s of FPGA on the development computer - strange results... Help, please

    Hello

    We ordered a 7851R DAQ card which we
    have not yet received and we try to simulate using the
    Setting "computer development".  However, I can't seem to get the OID
    to work properly. In fact simply opening "digital line input and.
    Example of output.VI' does not have to wait for results. What happens in the
    example of file is just, the indicators flash constantly and are not affected
    by controls. Is this a known problem and I just need to wait for my
    material or have I done something wrong?

    Thank you!

    Michael

    You don't mention what version of LabVIEW you use, but if
    you use a LabVIEW 8.6, there should be basically 3 options for
    Debug / simulate your VI on the development computer.

    The
    first is to run the VI on the development computer using random
    data for FPGA of e/s data.  I suspect that this is the option you
    currently using and only can be useful if a large number of logic in
    your VI depends on the values of the e/s database.

    The
    second option is to use a custom VI which provides FPGA simulation
    E/s data.  That sounds as if it was what you are looking for.  When you
    Select this option, you will also get a button you can
    Press to create a VI model that can be used to create your custom
    VI. If you look at the diagram of the VI model, I think that it
    should be relatively simple to understand how to insert your
    custom code.

    The third option is to run the VI on
    the host but the use of I/O of the real world.  In the latter case, a default value
    bitfile is automatically downloaded to the FPGA for you and the data is
    transferred from the device by the driver.  Of course, you cannot use
    This last mode until your material does indeed.  I hope this helps.

  • Compare the previous values of a control?

    Hello! I am communicating with via GPIB hardware. I'm rebuilding software to control the unit. Unfortunately, the GPIB bus is "clogged" with a lot of almost synchronous calls to the GPIB. In order to solve this problem, I would only request the GPIB, if a control on the front has been changed by the user. For example, to change a constant in time, the user changes the value in the control of constant front of time. An instant more later, a request is sent to display what unit was defined as the time constant. I wish that this request to the device will only be sent if the user has actually changed the value of a constant control of time. All calls are transmitted in time loop. Is there a simple and lightweight way to check if a control value has been changed? Thanks in advance for any help!

    The structure of the event is your best friend here. Use a value for orders change event.

  • Button, which initializes the values then releases control of more Boolean values

    I want to create a button that turns on a series of other buttons, but then releases the control to allow individual switching. The problem is that for my project I need to run the labview file continuously so when I change a control to true switch it keeps the value of the other true Boolean values. For example, I flick a switch to turn on all the lights at the same time but want to and then later have the power of the special lights individually. Then also have the option to turn off all the lights again with a click of a button. I can't understand this. I don't have much so far, sorry for that.

    Like this?

  • Set the value of cluster control in secondary school

    Hello

    Is there a way to set the value of control from one cluster to a high school?

    I enclose my screw in LV8.0

    Charly

    If you have a reference to the VI being put into secondary (which there or it is not in the secondary, right?) you can use it to get a reference to the façade of the VI. This in turn will allow you to read an array of references to all the controls and indicators on the front of the Secondary VI. Cross this table by looking at the text property of the label: for each reference in the table until you find the one for the control of the cluster.

    Now, use the specific function to more class to convert reference generic control of the pole to a cluster reference. You can use it to get an array of all the controls within the cluster. Now, go through this table by looking at the text property of the label: for each reference in the table until you find the one for control quevous want to set and you are there...

    Mike...

  • How to ensure that the value of a control (for example double) initializes the last value when the VI has been closed?

    I use a cluster as a control. I would like to double in this control to automoatically values to fill their last values set when the VI is opened or accessed for the first time. It would be great if someone could point out for me. Thanks in advance!

    In my opinion, the configuration files are the easiest method and the best.  Simply save your last values to the file when your code ends.  At the beginning of your code, to read the file and fill in the controls with the values read.  With the configuration files, the section name can be the name of the cluster, and key names can be control names.

    I know OpenG has some pretty nice to do, but I prefer to use the native functions OR when I can.  When porting to a new system, there is no need to copy any additional screws library (OpenG library).  The native DV come with Labview.

  • How can I change the value of a control on front panel?

    On the front panel, I'm doing a complex control that consists of a Slider control and control of the digital inputs. Both controls display the same information and either may be used for entry. When changing value, I want the other control to display the same value.

    How can I change the value of a control on front flap when another control changes the value? I know how to use a structure of the event to detect value has changed, but I do not know how to impose control on front panel to change its value in the block diagram.

    Why do you not use a digital display on the slider, and no code is required:

    EDIT: Yes, he said. ***

  • Save the value LVOOP to the default value of the class programmatically

    Hello!

    I was stuck on this little problem for quite awhile, maybe I can't see the wood for the trees, my intention is perhaps utopian

    Here's what I want to do: retrieve the default value of an existing *.lvclass class (not), change it to some sort of Setup, and then save the back by default to the *.lvclass file (or any other).

    The only planned mounting is on changing the default value, no more, no less.

    I tried a few magic Server VI in vain (LabVIEW crashed)

    Any suggestions?

    See you soon

    Oli

    Hello Oli

    With some, as you named: "Magic VI Server", it is possible to edit the default class data and save it as the same/new class. However, there are at least three major problems:

    • This is not possible in the runtime, because it requires features available only in script development
    • If you want to save the class changed as the new class, she would need to copy all the screws and the controls of this class
    • It is simply inefficient.

    So before we go any further, could you explain more thoroughly, why would you want to? If you have two classes, which are exactly the same, but differ on data default field values, this is absolutely not a good idea and not a good software design. And relying on the default values may generally lead you to unexpected behavior of your program in the future, when you decide to change these default values.

  • Detect the value in the control chain

    Morning all,

    A program of serial data I create, I must now write values to a device. The user will enter the appropriate values in a control to the string and press "write". Is it a kind of function / way that LabVIEW can automatically detect if there is a value in a command string... If so, it is written, otherwise it gets ignored?

    Thank you

    Richard.

    lvrichard wrote:

    As simple as it sounds... I have found using the equal fucntion with a string constant, can produce the result I'm looking for!

    If you are looking for just an empty string, there is the empty String/path? primitive.

  • Change of color of the page in a tab control programmatically

    AFAIK, you can manually change the colors of the individual pages in a tab control (if you have the property allow several colors set to True), but you can't do it programmatically.

    For my particular application, there is only a single page color, I need to change, so I can get the effect by setting the colors I want manually and activating / deactivating allow multiple colors on the control tab as needed, but I wonder if there is a better solution out there.

    Thank you

    Kyle

    Of course, you can:

    Not sure if you try to change the background or foreground color.

  • Send the name and the value of the control to Subvi

    Hi all

    I am trying to send the names and values of the controls to a Subvi.

    I know that I can check out the name and the value of the control by using a property node, but I was looking for a way to make is easy for the programmer to use.

    I think some sort of bundle function, it records the name and the value of the control, but I would like the programmer to be able to connect a random number

    controls to the Subvi without having to specify the number of controls Anywhere.

    I know there is stuff in labview configuration file, but it seems a bit more complex, so what I want to do.

    Also, I know that I can use the OpenG toolkit, but I will not use additional LabVIEW modules, as this VI may run on several different computers.

    I hope I made my problem clear enough!

    Good day

    Concerning

    Tommy

    What, creating an array of references to the command.  On the hand, you will need to fill the table with control references that you want to send to the Subvi.  In the Subvi, use a loop For with indexing to get every reference, and then use the nodes property to get the name and value.

  • Binding the controls on the front panel programmatically

    It seems that Programmatic binding the controls on the front panel do not work when they are located in a tab control.

    Is this a known problem in LV 8.6?

    If the control of the façade is already bound to a URL of PSP you can link to another URL using DataSocket URL property during execution of the VI.

    If the front panel control is not bound to a URL of PSP, then you cannot attach it to the URL of the PSP when the VI is on. You can use the method AttachDataSocket of VI to change the link while the original VI is stopped (in edit mode).

  • To access the controls and their values in different JFrames and forms

    Hi all - is it possible to access controls and their associated information? For example, in my old .NET application, I got a form where users could enter usernames/people with disabilities and also preferences for the launch of other external tools. The user filled in the text boxes and made a few selections on combo boxes etc. - I then recorded in an ini file which is loaded at run time. Then from anywhere in the application I could do something like:

    Dim strUserName As String = frmUserSettings.txtUserName.Text//for username
    Dim optLocalorRemote as String = frmUserSettings.cmbLocalorRemote.SelectedItem.ToString () //for selected item in the drop-down list box
    Dim optSomeOption as Object = frmSomeForm.SomeControl.Value //etc etc...

    You can call any control in any form and obtain its associated variables and also call any method belonging to him in .NET or void. Is it possible to do in the frameworks for Swing? I did some research but can't seem to find the equivalent in Swing

    If it is not possible can then someone point me in the right direction on how to do it? Do I need to define a class and I then have to instantiate each control in the class and have the getters/setters or y at - it an easier way? I essentially have an obligation to access related information across different forms in the application

    I found this:
    http://StackOverflow.com/questions/4958600/get-a-swing-component-by-name
    But this seems to return the control names and no values?

    Thanks in advance for any advice or help - we appreciate it! :)

    Hello Matt,

    for what you do with files .ini, java provides the java.util.Properties class.
    To access the other JFrames and forms (JPanels), you pass a reference to this framework/Panel to the place (class or method) where you want to retrieve information from this framework/Panel.
    Example:

    public class MyFrame extends JFrame {
      JPanel myPanel1= new JPanel(...);
    ...
      MyVeryOwnPanel mvop= new MyVeryOwnPanel(myPanel1,...);
    }
    

    Now within mvop, you can look at what happened to myPanel1.

    HTH

  • Programmatically disable the controls on the front panel

    Hi all

    I have a case in which I need to activate the control of front panel during scanning or taking data and when this case is false / when not not taking data. I try to make the Subvi usng vi reference, the node property, making the label controls and disbaling it. I want to disable the control listed in the table during the real deal and allow them to return to the case of fake. But right now, it of not working and hangs my main program. Please see the vi attached and help find where I am doing wrong.

    Thank you

    The best way would be to create an array of references to the controls you want to mess with beforehand.  I say that because I'm guessing that you have several groups of controls you will be turn on/off at the same time.  If you have a table of these controls already created, then just run the table in a loop FOR and use the Disable property.  I made a few minor cleanups in your current VI.  I got rid of the outermost case structure since the two cases are essentially the same thing.  A selection function allows to choose to enable or disable.

    NOTE: the forums are screwing again and not let me post a VI.  Change the extension back to vi to open it in LabVIEW.

  • menu bar popup not working if the focus is on the control of the chain

    Dear all,

    I wonder if this is the behavior expected or if I'm doing something wrong:

    On a Panel, I have a control of the chain; on double click, I opened a file selection box to select a file, then the file name on this control of the chain. After this action, this string is the active control, indicated by the gray frame.

    I also have a menu with some defined keyboard shortcuts bar for example F2. It seems that F2 is not functional, long as the focus is on the control of the chain. It's embarrassing because the typical user action is selects a file and then pressing on Fx. To resolve this problem, the user should click somewhere on the Panel to move the focus to another control. Of course this could be done programmatically, but the extra effort is not to say necessary for controls ring or digital controls. Also in digital controls, I can change the numbers, but even if a digital control is the active control due to the edition of the F2 value works immediately.

    Help is appreciated.

    Thank you

    Wolfgang

    I think what is happening here is that left double click is also used to highlight the text. So when you trigger the EVENT_LEFT_DOUBLE_CLICK, you're placing the text in the control of the chain and then also accentuating. It seems to be behaving strangely when the two of them occurs at the same time because of the order of the events. You can see that the mouse around when, returning from the file select popup causes the region highlighting to drag over the text. In this highlight mode, you cannot use the shortcuts for the menu. I was able to solve this problem by swallowing the EVENT_LEFT_DOUBLE_CLICK after you set the value of the control.

Maybe you are looking for