Boolean Array controlled clock reentrante Subvi

I am in the final stage of implementation of my program.

Currently, I have to overcome two obstacles.

#1 corresponds to the attached VI "my chronometer.

The round LED starts to count time and stops him. Problem is even if I turn it off it, the timer continues counting the seconds when I turn it on again. I want it accumulates only the time he spent in the position it. How can I do this?

#2 corresponds to the VI "time table."

I want to use "My chronometer" as a Subvi environment in this VI. I want the round LED Boolean table as the control to activate and deactivate the stopwatch.

Thanks for your help.

mhaque

To use as a Subvi, it is easier to use feedback initialized worldwide nodes. Here's a quick example.

(Place both live in the same folder, and then run CallTimerSubVI)

You use too much code. Please rethink what you were doing! Also look at my example.

  • Instead of 24 shift registers to use three, containing 8 elements berries (or the number of timers you need).
  • You need a resolution of one second, then place a wait inside the loop. There is no need to do turn 10 million times per second, you're just wasting cycles cpu and all the other programs of hunger.
  • A constant 1000 diagram is sufficient (instead of 16!). You can branch the wire.
  • Why divide the two values of 1,000 and then add? You must first add and divide once!
  • Why reverse the Boolean values, swap just the case if necessary?
  • (Even if you really want to reverse all Boolean values, do it once on the side of the table.)
  • It is a little VI, why optimize on-screen?
  • Note that my code is progressing well. A few minor changes would allow it to be used with 100 timers. To do the same with your design program would be impossible.

Tags: NI Software

Similar Questions

  • Passing parameters to a reentrant Subvi

    Hello! I called a reentrant Subvi, as explained in http://digital.ni.com/public.nsf/allkb/9CE784F50F816EA18625751900775EBB. It works (I can start several instances of the Subvi), but for the good use, I need to pass the parameters to this sub - VI.

    I tried:

    (1) to use the limit to a data Jack - as seen, controls on the front panel of the show clone for a very short time, they were connected to the Jack, but after they are inactive and empty

    (2) to set the parameter of the vocation of the Subvi using 'Control Value.Set (Variant)'. In this case, I see fileds correctly initialized control on the front panel of the Subvi, but are not used - other control fields, which must be initialized with these starting values are empty.

    Before I called this "typed stricktly" Subvi, settings were connected to the inputs of the VI and everything went OK, except that I couldn't call the Subvi reentrant type stricktly - only an instance was active, then was opened when the previous one has been closed.

    What is the problem?

    Thank you in advance for the answers

    You are spawning the screw as it seems.

    The node "Call by reference" no do not work as you expect the reason is simple: the call of reference node of will end only if the VI called ended.

    I do not recommend to use datasocket for data transfer. Above, is that you don't need. You can always do it, but you must write the data to update the values. Just link it is not enough.

    Pass values using the VI Server (you must pass every parameter to a node) or using other transfermechanisms:

    -FGV, also known as AE

    -Notifier/tail

    -TCP based protocols such as STM

    hope this helps,

    Norbert

  • Hyperlink in a Boolean palette control

    some time there is need to display your menu item in the application as hyperlinks.

    LabVIEW doesnot provide a direct solution for this.

    If you want to customize the button control to look like hyperlink, it will add too much code including the structure of the event (if anyone has an effective solution for it please) which isn't really afforadble if you have several hypelinks.

    I suggest that labview should have built into the hyperlink control that behaves like hypelinks when the mouse enter and leave control and evaluates to Boolean TRUE when you press.

    ---

  • Prerequisites for reentrant SubVIs to run in parallel

    Hello!

    In my VI, two clones préallouées of a Subvi, I thought I would go in a separate thread of each. Just this sub - VI contains a reference to a double and it increments. The two clones ran in parallel, but not in separate threads. For comparison, I did a Subvi, which does not have a reference - these clones run each in own thread.

    I noticed this watching the CPU usage: in the first case, has been used as a single core in the second respectively two sons were used.

    (1) I wonder what are the prerequisites for a Subvi to run effectively not only in parallel, but in fact in separate threads?

    (2) is there a way to discover during compilation which (Tufts) parts of a VI run in parallel, and SubVIs get making their own thread of execution?

    For reference: the execution is slow. If I understand correctly, the GUI is running in its own thread, so no interfering only not with the SubVIs that multiply references. I think that there is also no locking a reference readings and writings to a reference should be very fast. Is this correct? If so, why is this slow running?

    Thanks for your replies

    Marco

    (The test computer has a Quad-Core with Hyperthreading, using LabVIEW 2012SP1)

    One thing I know is if you have any manipulation of the UI elements.

    In the case you use a reference to a UI element user and properbly using the property node to insert data.
    This limits LabVIEW for your sub vi of in the UI thread.

    If you have transferred the values on the queue to a vi that manages all the user interface controls, then only that vi will be in the UI thread.

    Who is?

  • How to dynamically add any control (digital button, boolean) to control the line and selected column

    Hello

    How to add a control (digital button, boolean) dynamically in control instead of lines and columns selected. Please suggest the idea or no matter what example code you have please share with me...

    Thank you

    Vieu

    Essentially, that's what you're looking for:

    Please note that you have to account border sizes and the label of the control so that the code does not work right out of the box. You should also check for the height and width of column and if the position is valid at all before moving around the control.

    Norbert

  • exit node digital fpga Boolean realtime control

    I have a system where I want to enable / disable a digital output running on FPGA.

    Once I set the Boolean value on my side in real time (which turns out FPGA), I see the output turns on the CRIO, but it flickers on and OFF (do not lock?).   I just want the FPGA to stay as long as the output is enabled, on the coast in real time.  I can't change the mechanical action of the switch because of limitations on FPGA / RT according to labview (I get an error on compilation)

    Any suggestions on how to fix this?

    tman2013 wrote:

    What I am doing wrong?

    You reset the FPGA inside of the loop, in "Open FPGA Part.vi. You must open the FPGA reference once, outside the loop, instead of open it several times. Whenever you reset the FPGA VI, exits back to the default values.

  • How to declare the size of the array in a labview subvi


    Hi, I posted a response and documentation in the CVI hereforum: hope, he can help you.

  • Control relay with Boolean switch using DAQ assistant 9481 - problems

    Sorry for what may be a stupid question but I'm stuck in quicksand.

    I use a relay module 9481 and have two external relays connected lines 0 and 1.

    When I create a digital output 0 line by line, I can run the test inside the express and activate the relay and turn off without problem.

    The generated block DAQ expressed expects a Boolean input of 1 d. (See attached photo).

    I want to connect a Boolean switch relay line disk 0. You can connect live not because the switch is Boolean and the input is Boolean 1 d - I'm a conversation in the pict.

    All plumbing lines display results, the relay never active.

    Any bunch would be greatly appreciated! Thank you

    Mr._Mechanical,

    Welcome to the Forums of switch OR this forum is generally intended for products OR-SWITCH [such as the NI PXI-25xx & NI SCXI-11xx], I think I know the answer to your question.

    I think the reason why it's a failure is the conversion you make generates a table of 16 Boolean [as the 'boolean to (0,1)' function creates a data I16 type] with your data more false data points 15.

    When you try to control the relay, he sees 16 datapoints are you Commander to a single port [channel] and so error out.

    My suggestion would be to use normal DAQmx digital output screw [with, he set up as ' Digital > single channel > single sample > Boolean (1 line) "] rather than the DAQ assistant.

    If you use the daq assistant, simply by using the function 'Building the table' will transform your simple Boolean data point in a Boolean array containing a single element.

    While the DAQ assistant is very easy to use, I recommend that you use the DAQ assistant, because this reduces the features and increases the execution time.

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

  • Boolean index in the array

    In Matlab, often use a Boolean array to access the specific values in a table.

    It is a good way to reduce the itterative loops and improve the speed of the code.

    I'm trying to find a way to do this in a Mathscript node, otherwise the code takes forever to run.

    Common code in Matlab and Mathscript:

    a = [1,2,3,4,5]; % This is normally a much larger range

    b = [1,0,1,0,1]; %I whether Boolean, but by default it's double

    c = b > 0;  b change % to boolean

    d = [9,9,9,9,9];

    The Matlab code is:

    d (c) = a (c);

    d

    > d = [1 9 3 9 5]

    If I run the above in Mathscript, I get the following error:

    In Mathscript, to achieve the same result "d" I currently have this:

    for i = 1:length (d)

    If c (i) == 1

    d (i) = a (i);

    end

    end

    d

    > d = [1 9 3 9 5]

    A slightly faster version is:

    for i = 1:length (d)

    j = 1;

    If c (i) == 1

    e (j) = c (i);

    j = j + 1;

    end

    end

    d (e) = (e);

    d

    > d = [1 9 3 9 5]

    Any ideas?

    Thank you

    Hello

    The code you have posted works fine in the MathScript in LabVIEW 2009 node as well as in the MathScript window and the MathScript node in LabVIEW 8.6.  As such, I'll assume that you have found an error in the window of MathScript in LabVIEW 2009.  We have already identified this problem and currently filed the bug report 151999 for her.  You see error message did not come through in your post, so I guess it is-90026: ' indexes for an indexing operation matrix must be real and positive integers. "  The problem is that we do not treat the indexing variable 'c' as a boolean type.  As a result, it reports an error when it tries to use the index 0 instead of a fake.  We are working on a fix for a future version.

    To work around the problem in the MathScript window, you can use find instead of any Boolean indexing command.  It should integrate more quickly than the implementation of loop that reference you.  Instead of
    d (c) = AC;
    use
    d (Find (c)) = a (find (c));

    Grant M.
    Staff software engineer | LabVIEW MathScript | National Instruments

  • How to select cases or an event using an array of Boolean 2D.

    Hello world

    I'm trying to use an array of Boolean 2D to select different events or case. For example, if the variable Boolean 1 and 2 are TRUE, case 1 will be selected. If the Boolean variable 1 is FALSE and 2 is true, case 2 will be selected and so on. I tried to use the Boolean to the number, but I need a way to differentiate between B1 = B2 = FALSE and B1 = B2 = TRUE, FALSE, TRUE. In other words, no two Boolean combinations can lead to the same case, seminar.

    ~ Mario

    You need to remodel your table 2D to 1 d first.

    Now, assuming that you have the items in table 64 less thant, "boolean array to the number" will give you a unique number for each possible combination of bit.

    M_Mario_M wrote:

    I tried to use the Boolean to the number, but I need a way to differentiate between B1 = B2 = FALSE and B1 = B2 = TRUE, FALSE, TRUE.

    As mentioned, each combination will give you a different value. You must simply ensure that you Add unique cases for each number. Add as many cases you want to structure your business. If you do not, several models of trigger default case-sensitive.

    If your problems persist, please contact your code.

  • SubVIs cannot reference the Parent controls

    Is there anyway that a Subvi can reference controls on the façade of a relative of VI? Without this ability, it is difficult to reduce the complexity of a VI using subVIs, when a front panel control is involved. Variable property nodes do not seem to be the ability to reference a control in a VI parent. Is it possible to fix this?

    There are two ways to do this:

    1. use the connector pane to indicate the reference to control of the Subvi.

    2. open a VI reference to parent VI or get the reference through the connector pane. Use the [VI:Controls] property node to get references to all of the controls. You must use a loop to get good verification of the label control. As far as I know, the sequence is in the tab order in order to be able to use an index.

  • Values in the array of Booleans to dictate the output to be Boolean False or Boolean True

    I have a pretty simple question that I have a problem to solve.

    I'm looking to enter a Boolean array for a sub - vi that will take this table and dictate a single boolean output Boolean false or Boolean True.

    For example, the table will be table boolean 1 d, with a depth of 2 index values.

    -If the two index values are wrong then the sub - vi will kick for a False value.

    -If the two index values are true then the sub - vi will kick on a True value.

    -If an index value is True then the sub - vi will kick a True value.

    Any ideas?

    Thank you.

    jonathanupr wrote:

    -If the two index values are wrong then the sub - vi will kick for a False value.

    -If the two index values are true then the sub - vi will kick on a True value.

    -If an index value is True then the sub - vi will kick a True value.

    It sounds like an RC for me

    jonathanupr wrote:

    For example, the table will be table boolean 1 d, with a depth of 2 index values.

    I don't know what you mean by that.  How you choose to use indexes?

    EDIT: Perhaps you need some Elements of array or

  • Position of the element in the array of Boolean

    Hello

    I have an array of Boolean, whose elements are initialized to false. For example,.
    private boolean array[] = new boolean[10];
    Subsequently, I put an element of the array to true. Let's say that
    array[5] = true;
    My question is how can I get the position of the whole of the element whose: value (s) was/is real? Is there a method that does this? I looked in the class of paintings, but could not find anything.

    Thanks in advance.

    There is no built-in function. Just write the code yourself, it is not difficult. Simply iterate on the table and when you find a true value, you have found your index.

  • How to change the number of items in number to Boolean, function VI table

    Hi, I'm working on using the digital output of data acquisition to control the digital input of a DAC, and I used the Number function in Boolean table. VI to convert the number to a Boolean array. The maximum number is 4096, so it must be composed of 12 elements.

    For the description of the VI, it is said that Boolean matrix returns a table of 8, 16, 32 or 64 elements, according to the number of bytes in the whole. Therefore, I change the number of channels in the task to 16, but it still does not work. The suggesitions are greatly appreciated.

    Thank you!

    Possible reasons:

    Scripture cannot be performed because the number of data channels does not match number of channels in the task.

    When writing, provide data for all channels in the task. You can also change the task so that it contains the same number of channels as the written data.

    Number of job channels: 12
    Number of data channels : 32

    Task name: _unnamedTask<1B>

    Once you have the array of Boolean, you can resize using table tools. For example you can use the "new range" with a length of 12 to pad the table of 12 elements of Boolean values (you can also use a subset of table).

Maybe you are looking for