Notifier / while loop question

I have a question that has probably a simple answer, but which has been eluding me for a few days.  I have two loops in parallel: one that sends commands to a controller embedded on the series and one who reads the data returned by the controller.  I want the loop 'send' and the 'read' loop to run at their own rates, but I want to only read data in the loop 'reading' for write in an excel file after sending the command "GO" until the "Stop" command is sent.

I tried to use tax filers of the loop 'send' in the loop 'read' to tell the loop "read" when at the exit of the excel file, but only slowing the loop 'read' to run whenever he gets the notifier.  I want the 'read' to run all the time, but orders for the period of time between "GO" and "Stop" only to write in the file excel duing.  Does anyone have a better suggestion?

PRCalDude wrote:

I tried to use tax filers of the loop 'send' in the loop 'read' to tell the loop "read" when at the exit of the excel file, but only slowing the loop 'read' to run whenever he gets the notifier. I want the 'read' to run all the time, but orders for the period of time between "GO" and "Stop" only to write in the file excel duing. Does anyone have a better suggestion?

You are on the right track, but the function wait on Notification in your 'read' loop can give a zero ms timeout value and it will keep ticking along without waiting for a new notification. You can use the 'timed out?"out to decide to use the last value (that you store in a shift register, output of notification is the default value for the data type when the wait times out) or the last notification. Like this:

And, although I prefer never to see again a local Variable, I shout Thoric downwards. He meant well

Tags: NI Software

Similar Questions

  • Two questions in table "While loop"

    Hello

    I have two questions about creating tables in while loops. I'm using LabView 8.5.1.

    In its simplest form, my current while loop (delay set to 0, 2 s) has 3 variables that have been changed by moving a slider. They are each sent to a line in a block of 'Building the table' (data type is DBL 1 d) - this table is then written to a spreadsheet file, such as the three values are written to a new line (one value per column) whenever the while loop runs.

    Question 1

    How can I add a column 'Time' in this worksheet? In other words, get at the present time the loop works since then, from 0 seconds in the spreadsheet, via the table block building.

    I can think of how to do this with a loop For, but given that the While loop runs through an unknown number of iterations, I can't figure out how to get the counter to work.

    Question 2

    How can I text column headings on the worksheet?

    Thanks for the help and if you need anything anyone stating, please let me know

    To answer question 1:

    There is a function of 'Elapsed Time' you can put as the first colum of the data.

    This then reformatted your spreadsheet as
    Time Data1 Data2 Data3

    Time Data1 Data2 Data3

    Time Data1 Data2 Data3

    etc...

    To answer question 2:

    Build a table of positions, then write this table in the file only once, outside the loop.

    Your table with the data and time will write inside the loop.

  • LabVIEW FPGA while loop (first call? (VI) question

    Hi gentlemen!

    I am creating a LabVIEW FPGA VI appearing in a WHILE loop. He has a first call? VI in which, in the first occurrence of the loop, a variable must be initialized to some value. However, when I incorporate the VI in the FPGA, it would seem that the first call? VI has not been called. I also tried this implementation through registers at offset where the registry is initialized outside of the WHILE loop. However, the result is always the same. May I ask how the LabVIEW FPGA functions when it comes to everything IN a loop? Thank you very much!

    For some reason that I don't me remember not I avoided the use of FPGA FirstCall and instead, I use a change sign boolean, son of genuine in the terminal, on the left and a fake in the while loop to the right Terminal. As a result, you get a true for the first iteration only, in exactly in the same way that the function of FirstCall. It could even use fewer resources on the FPGA?

  • I can constant maniuplate outdoors to separate while loops?

    What I want to do is subtract the constants incrementing in while loops 1 & 2. I removed the meat of the code, as it would get in the way of the question. Basically, a value is read (outside the structure of the case) each time, iI want to increment the "number of times read. The same thing happens in the second loop (they are basically independent of each other). I can't escape outside the while loop because the code never leaves the loop. I use a global variable? Thanks for any response.

    You will need to put in globals or functional globals to make your available outside your earrings acquisition counter values.

    You'll need a third loop at the same time to do the subtraction of values you have in your globals.

    You can also examine the help of queues and the authors of notifications.

    Another way to do would be to unstack a notifier received notifications whenever you receive a tag and then have a processing loop that manages the authors.

  • Notifier - for loop

    Hello

    I do a parallel program, so I need to use a notifier to tell this process that was an event.

    For convenience, I'm building a simple program.

    I have a loop FOR who travels to 1000 times. I need that every iteration is executed once a loan (OK) is pressed, the button is pressed and if it does not need to wait. Also, I need to have a STOP button if you press on at any time, stop the program.

    I built one Notifier while structure to make the wait until ready is key and structure of the EVENT to question LOANS and STOP buttons.

    can you tell me what I am doing wrong?


  • What is READ the array returned by the DAQmx meter? How can I know the two functions DAQmx READ data stream in the same WHILE loop?

    I have a question about the order of execution.  In the WHILE loop, I have two things to measure, period and tension using the DAQmx READ functions for voltage and the meter.  In the end, I want to collect these data as points almost simultaneously as possible, as a pair and then send them together to another piece of code (not shown here) which them will result in some sort of command for an engine.  It would be run, and then I want to perceive the tension and the period at a time later and do the same thing.

    (1.) I'm a little confused on what the meter of the READ function is back because it's a table.  What is a picture of?  I thought that it was up to the value of the individual periods between rising edges.  The output of the counter 1 DBL d's a table. How many elements in this table, and what determines the size of this table?  Are the elements of the array the individual delays between the edges?  How many values are stored in the array by executing?   We take the AVERAGE of the last 15 items, but do not know if we are throwing some of the data or what.  How to understand the composition of this painting?  How can I change the composition of this painting?  Is it possible to measure only one period at a time, for example the time between TWO edges?

    2.) Will this WHILE loop execute as it gathers tension and a "period table ' (remains to be understood by me) by TIME running in a loop?  In particular, we want that the value of the tension associated with the value of the AVERAGE of the period "array", so we can use two data items to create orders of next control every time that the two values are reported.  The structure for the delivery of vi will be attached data in pairs like this?  I understand that one of the READING functions run not before the other function of READING in the WHILE loop.  I want that the period "means" and "strain (Volt) collected at the same pace. This vi will he?

    Thank you

    Dave

    Hi David,

    I suggest including the DAQmx Start Task function. If it does not start before the loop, it starts the loop and work very well, but it is not as fast and efficient. In the model of task status, task wiill go to run the checked each iteration of the loop and then back the time checked running when it restarts.

    The status of the task model: http://zone.ni.com/reference/en-XX/help/370466V-01/mxcncpts/taskstatemodel/

    Kind regards

    Jason D

    Technical sales engineer

    National Instruments

  • Subvi with while loop + event structure works is not in multi tab VI

    Hi all

    I'm developing an interface for the control of a prober using Labview 2012, and I'm stuck with a question.

    First I provide you with a simplified version of my VI control interface and the sub - VI used to generate and manage the mappings of wafer.

    The VI is composed of several tabs: Prober initialization, manipulation of Wafer, Wafer map, status, error.

    The sub - VI can:

    1 / initialize the grid to display the map (Subvi Init grid not provided here)

    2 / coordinates XY for import a txt file (Subvi Wafer map Import)

    3 / view contact information and the index of the sector under the cursor

    4 / and what position die is double clicked and the Boolean 'Edit Wafer map' is true, then the user can change the State (color) of the matrix between die on platelets and selected Die

    My question:

    If I use the sub - VI by itself, it works fine. However, when I use it as a Subvi in the 'Wafer map' tab, the plan does not rise and I can use any features incorporated into the Subvi.

    I suspect that the while loop + structure of the event of sub - VI the bottleneck here.

    However I do not know which way to go, that's why I'd be happy to have some advice and help here.

    Thank you.

    Florian

    The question arises because your hand loop 'for' cycles of 33 times.  In the loop of 32, appears your Subvi and execution is passed to your Subvi.  During this time your main VI expected Subvi in the end, she never does.  You could spend your Subvi out of the main loop of the program and run in a separate process, in order to pass data using queues, but you have to find a way to close the Subvi (i.e. a queue).  By moving the Subvi on the main process, it is independent and you can do what you want to do with the events and others.

  • Control and Simulation in a loop / while loop with TCP/IP reading / writing of synchronization

    Hello, I have a problem with reading TCP/IP and written in two loops. The problem is NOT to get the two loops to read and write to and from the other. This has been accomplished. My problem is when I run control and the loop simulation on my laptop and the while on a RTOS remote on the controller on-Board of LabVIEW in a remote PXI chassis, the while loop the remote system running on four 4 times faster than the loop control and simulation on my laptop. In other words, for each iteration of the loop control and simulation on my laptop, there are 4 four iterations of the while loop on the remote system. I need to know how to get a degree of kinship (1:1) with these iterations of the loop. When I run a longer simulation in real time, say 10 seconds, the control and Simulation loop begins to slow, i.e. the simulation time slows down until it is no longer in real time and the "Late Finish"? Parameter is set to true and the LED lights and continues to stay lit. At this point, the system destabilizes due to what I believe is being well sampling rate too discreet and I have to end the simulation. How can I get a ratio of one to one between the loops and also to avoid slowing the loops causing destabilization?

    To give an overview of my application, I implement a control system in a network, seen in "image2.png". This is achieved using my laptop as a subsystem 1. Reference signals are generated from the laptop and the error signal is produced. Control measures taken and the control signals are sent via TCP/IP to the remote system. Position feedback is returned, and the process repeats. My system has Core I7 Procs w / 3 GB of RAM, up to 1 GB/s speed via ethernet and LabVIEW 2011 installed with all necessary modules and networking tools. The attached VI Custom_Wireless_Controller works on my laptop. The remote system I'm working on that has the 7830 NI R Series with FPGA card. OTN runs on the PXI chassis with an enbedded controller that has networking capabilities of up to 100 MB/s via ethernet. I use the FPGA for the acquisition of data and apply control signals to my plant. The plant is the PCE twist connected to the FPGA through the cable of the ECP - RIO of NOR. Subsystem 2 is this side of the CNE. The FPGA collects position, he sends to the controller via the network, receives signals from the network drive and writes signals to the plant power amplifier that operates the plant. This process is repeated and the VI and is titled Custom_Wireless_Plant.

    I appreciate the help really and look forward for her and for any question!

    Well, the first step is to understand what you have set up right now. Your control and Simulation loop on the side of the controller is configured as 'Runga Kutta 4' and you have a loop timed on the other side. In addition, you have the primitives of TCP/IP on the control and the Simulation diagram and means he will perform (a message) on the size of each minor step, which in your case is 4.

    So, you have two options:

    1. replace the Solver side controller Runga Kutta 1 (this must synchronize loops)

    2. hold RK 4, but create a Subvi around two primitives of TCP/IP and configure from the VI to run than the major (continuous) step-size. If you do it right, you should see a 'C' on the upper right part of the VI you have created.

    Please let me know if what I said is not clear...

  • While loop within a while loop

    Just a general question, is a timed, while that while loop the loop inside of a timed bad design practice?

    Any feed back on why it shouldn't be done is appreciated.

    mhaque

    Yes, it's very bad design.

    The outer timed loop cannot complete its iteration unless the timed inner loop ends. This means that its target of time cannot be carried out unless it is guaranteed to be much longer than the total time of the execution of the inner loop. Too late!

    What are you actually trying to do with all this?

  • Error with parallel while loops

    Hello

    I need to connect 6 different instruments gpib. I am using parallel loops, but the problem is when I try to open 2 or 3 Subvi simultaneously (the intstrument drivers), I just open one because of everything in a loop to run the Subvi. The program should be able to open all the Sub - VI independently.

    Can give you some ideas?

    Thank you

    A. Castillo

    Look at the detailed help for functions to notify.  Then follow the links to the examples included with LV

    Another problem that you have, whether you use your curls greedy or reporting or another technique, is to know how to stop your hand while loop.  All the subVIs must be called before the loop stops.  This is the fundamental paradigm of LV

    You will probably need to rethink your primary architecture to something that will actually do what you want.  Plan and design before your departure from the coding.  Note requirements for the program and determine which parts are dependent on othrer parts, then select a program architecture that can meet the requirements.

    Lynn

  • Update an indicator of in while loop with event driven programs

    I'm trying to update a chart shared by several events within a Structure of the event. I would like a change in value of a button (NOPE or OK buttons in the attached example images) causes the structure of the event causes a switch between the various outputs for the chart. In the example attached, clicking the OK button will send the graph random matrices, while clicking on the button NOPE will send constant tables to the curve.

    As the process within the structure of the event is underway, I use a while loop within each of the different events in the event Structure. So there is a structure of the event, and each event have while loops in them which should update the chart outside the structure of the event (see attached images).

    This does not update the graph, the graph remains static instead, why is this? How can I configure it to work as I described above?

    In my view, a question is: How can I use the same stop button in both inside while loops. In the example images, I have two that are different, one for each of the different events.

    Thank you!


  • While loops inside while loops, how to stop?

    Hey, I'm confused with a simpler question to multiple while loops. My goal: stop or pylone2, just jump out of the small loop and stay in the big one. and if I click on stop 3. the entire program would cease... How can I do this? The following script does not at all... Thanks in advance!

     

    Yes you are completely right Mike... now, I solved the problem with another structure of the event and the Boolean variable local... Thank you very much!

  • Static analog output without a while loop?

    Hi all

    Would like to know if it is possible to set up a card outputs analog instrument (with DAQmx I presume) to have a static/continuous output, without needing to use a while loop.  I what would want to return a single value rather than a table or a waveform.  It would be similar to option for digital IO cards to have static strings instead of strings of waveform.  In the examples I've seen, he always seems to be a time loop is necessary, even if the channel is configured for a single sample, but I think it would be cleaner and easier to control dynamically without the loop (particularly if I run several screws in parallel).  My particular application is to configure inputs and outputs analog, then runs different tests with other maps of the instrument.  Please notify.  Thank you.

    GSinMN

    No, you don't need a loop. A writing DAQmx for 1Sample game, it's all you need. Please include am image of the pattern block one of these examples. My guess is that the example is simply a way to accept changes in production without having to re-run the whole VI.

  • Measurement of time in a While loop

    Greetings gentleman;

    I'm kinda new to Labview, and although I sought an answer without assignment, I wasn't able to find one.

    So here my question, I would like to know how I can measure the time a loop sequence, in other words, what time is my point of view VI to run the main loop together?

    A little explanation, the attached VI tries to be a Markov chain, it takes some values in the first case structure based on the previus loop, then, if the values are correct, it passes to the next step and so on. It's pretty simple, and yet, my problem lies in the measurement of time. Since it is a 'distribution', it would take infinite time to execute a simple loop if it does not fulfill the characteristics, but it is scheduled to meet them so an average time should work.

    So, if you look to the while loop, should the big one, I want to measure how long I take for a ride.

    Thanks for the help, I'd be happy to read some ideas on how to measure this.

    Kind regards

    IRAN.

    You will find examples in the example Finder OR by searching for 'speed test' or ' reference '.

    Essentially, you create a flat sequence structure inside of your loop. In the first image, you measure the current number of cycles. In the middle frame, you run your code. In the last image, you measure the number of cycles again and subtract the first number of this. This gives you the run time to execute the code.

    You can see a page of the community about it here.

    There is a high-resolution time tick count VI hang out somewhere which is great for benchmarking and improving efficiency, used instead the number of cycles (ms) primitive.

    Edit - remember where he was

    https://decibel.NI.com/content/blogs/EvanP/2010/10/04/tick-count-us--microsecond-timing-granularity-...

  • Problems with opening the file with while loop

    Hello everyone,

    It is probably a quick question, but I know how to open data files in Labview. The attached code works if you enter a file from the folder on the front panel button. However, if the path is empty and you press the run (arrow) button, a dialog box appears and asks you the file.

    I select the file, but the dialog box keeps coming back. I think it has something to do with my while loop. Can someone tell me where I'm wrong?

    Thank you!

    TheLT


Maybe you are looking for