DAQmx: synchronization of the two tasks of pulse output

Hey Gang,

I need to synchronize two tasks of pulse output.  I use the PCI-6601 Counter-Timer.  I need to use two tasks because the second output frequency must be a multiple of the first.  I think that the way to do it is using arm Start Trigger functionality.  I found some information on this site about it, but the examples spoke using a "dummy" analog task, I do not understand.  I have found no documentation on the trigger to begin arms in the DAQmx documentation.

For reference, here's the enforceable part of my code:

TaskHandle DetHandle, LasHandle;

DAQmxCreateTask ("DetPulses", & DetHandle);
DAQmxCreateTask ("LasPulses", & LasHandle);

DAQmxCreateCOPulseChanFreq (DetHandle, DetChannel,
"DetChan", DAQmx_Val_Hz, DAQmx_Val_Low, 0,0,.
StateSettings.DetFreq, StateSettings.DetDuty);
DAQmxCreateCOPulseChanFreq (LasHandle, LasChannel,
"LasChan", DAQmx_Val_Hz, DAQmx_Val_Low, StateSettings.Delay,
StateSettings.LasFreq, StateSettings.LasDuty);
DAQmxCfgImplicitTiming (DetHandle, DAQmx_Val_FiniteSamps,
StateSettings.DetPulses);
DAQmxCfgImplicitTiming (LasHandle, DAQmx_Val_FiniteSamps,
StateSettings.LasPulses);

DAQmxStartTask (DetHandle);
DAQmxStartTask (LasHandle);

DAQmxWaitUntilTaskDone (DetHandle, 10.00);
DAQmxWaitUntilTaskDone (LasHandle, 10.00);

DAQmxStopTask (DetHandle);

DAQmxStopTask (LasHandle);

DAQmxClearTask (DetHandle);

DAQmxClearTask (LasHandle);

I think I need to insert the startup code of arms before the start of the tasks, but I do not know what device to use for the relaxation of the beginning.

I'll appreciate any help.

Thank you!

Roger

Hey Jorge and all,.

I appreciate the effort you do in my name.  The simplistic answer proved to be using the correct syntax to specify the name of the terminal where the starting arm trigger specification may find the edge of digital triggering.

I use an output digital as the trigger (not shown in the code segment):

>>>>

Adjust the arm trigger for meter market
DAQmxErrChk (DAQmxSetArmStartTrigType (DetHandle, DAQmx_Val_DigEdge));
DAQmxErrChk (DAQmxSetDigEdgeArmStartTrigSrc (DetHandle, TrgTerm));
DAQmxErrChk (DAQmxSetArmStartTrigType (LasHandle, DAQmx_Val_DigEdge));
DAQmxErrChk (DAQmxSetDigEdgeArmStartTrigSrc (LasHandle, TrgTerm));

The "TrgTerm" variable contains an array of char as "/ Dev1/PFI0" "EUREKA" discovery is that requires an oblique protagonist to work.  In other functions DAQmx I used that was not necessary.

All of this consternation was absence of a single character ' / '.  It would be nice to add this to the DAQmx database somewhere.

Best regards

Roger

Tags: NI Software

Similar Questions

  • I can't stop finite samples daqmx read between the two?

    Hi all

    I want to read data from 10 seconds to a trigger is received. for this im using daqmx task finished sample mode and read the data on the trigger getting. It works fine but I can't stop my vi between the two when its reading of the data. I have to wait for it to complete the reading of values, and then stop the vi.

    so I switched to continuous sampling mode that allowed me to stop the vi whenever I want.

    I just want to know is there any means or the property using which I can stop my task over daqmx read when I want?

    I guess you call DAQmx Read with extraordinary value (-1) for samples of #.  It is also the default if left thread continues.  In a finished sample task, it means to wait until the memory full buffer has been filled with samples before returning.  Once you make that call, you cannot directly finish soon.  You're stuck waiting for buffer fill or for the timeout expires (default 10 seconds).

    One way to avoid getting stuck is not to ask for samples that do not exist already.  You can query a DAQmx Read property, known as the "Samples available" or something like that and son of this result in a call to DAQmx Read.  Such a call will return immediately whatever data are currently available.  Subsequent calls will give you samples.

    -Kevin P

  • Question about the synchronization of the two methods...

    I have 2 methods:

    writeData() //method 1

    createNewDataFile() //method 2

    the main thread will use method 1 quite frequently. In method 2, a separate thread wakes up every 10 minutes or if some maintenance on the file in method 1 to write. Thus, when the thread is in method 2 I need method 1 for the day before and wait. I also want the opposite, that when the main thread is in the 2-1 method will keep.

    Any help is appreciated!

    799454 wrote:
    So wait,

    I thought synchronized only worked on current methods where it is stated:

    Using the synchronized keyword requires a lock. Every object has exactly a lock that are associated with him. Once a thread has obtained the lock of an object, no other thread can only obtain this lock (and therefore cannot enter into a canton sync on this lock) until the first thread releases leaving his block of synchronization or by calling wait().

    so you're saying that if I declare:

    Synchronized, method 1

    Synchronized, method 2

    then I have a single object with 2 synchronized methods, so if thread A is in EITHER of these methods, the other method will be locked as well?

    The method is not "locked" in itself, but yes, 1 item, 2 methods synchronized, if T1 is in both methods, then T2 can enter either method.

    I urge you strongly to go through this tutorial or a book on Java concurrency, carefully.

  • Problem with the generation of two internal counters pulse trains

    Hello

    I do a control of temperature for two heaters, OR 9472 (output module digital), NI 9271 (RTD for measuring temperatures) and cDAQ-9174 chassis. So, I use the internal meter NI 9174 to generate two pulse train on the outputs (I tried with both cases-> pulse continuous and finite). Before that, I have two separate PID.vi, in which each sent the percentage of cycle of obligation for the two tasks of pulse generation (I configured these tasks with the physical channel cDAQ1Mod1/ctr0 and cDAQ1Mod1/ctr1). The problem is when I run the program, because the application initially worked fine, but after a few seconds the communication between the chassis and the application is not respected (no error message, but the external LEDs on the NI 9472 module had been disabled and stopped too NI 9271 module temperature readings). Then I tried to stop it with a 'Stop' button, but nothing happens. After, I abandoned the race and still nothing happened. So, I finished the Labview program with the Task Manager and a message appeared "reset VI: xxxxx". Finally, I have to restart my computer to run the program again. Can anyone help with this please? If you need more information, let me know.

    Kind regards

    Hi Luis,.

    I have the error cluster connected. But I solved my problem in a different way. I don't know why, but when I configured my RTD module with the DAQ assistant to test some of my design in a new file in VI, the RTD module works fine, but if I copy the entire program logic (include my DAQ assistant) back to my main VI folder and run the application, only for communication between my DAQ hardware and my software works there shortly. So I solved my problem set up any device or module in the same file from the application again and problem disappears.

    Thanks for your help.

    Luis C.

  • DAQmx 50103 error, two tasks of MAX on the E-series

    A bit of a surprise here, even after reading all the posts on the infamous error of-50103.

    I'm debugging a data acquisition task, in LabWindows/CVI, for a PC with an E-series PCI card (PCI - 6032E, I think). There are two analog channels: one is a photoelectric sensor ("receiver") that is read in bursts, the other ('power') is an electricity meter that is read from time to time. I've set up two tasks, Max with the corresponding calendar and the trigger settings; Load them into my program using DAQmxLoadTask() and others, and we're off. Where I encountered problems, that's when I need to restart the task of 'Receiver' and re - allocate buffer according to certain parameters of execution. When I do that, the call to DAQmxStartTask() fails.

    If, as I understand it, the problem is that you cannot have two tasks simultaneously running on the same tray, so why don't I get the error-50103 when I first start both tasks?

    The basic sequence looks like this:

    Init() //called once at the beginning of the init program the two tasks

    DAQmxLoadTask (& Receiver_handle)

    DAQmxSetTrigAttribute (& Receiver_handle)

    AllocateBuffers()

    DAQmxLoadTask (& Power_handle)

    DAQmxSetTrigAttribute (& _handle Power)

    AllocateBuffers()

    InitTask(&handle) //called to stop and restart the task of the receiver with new buffer settings

    CloseTask(&handle)

    StopDAQ(&handle)

    DAQmxStopTask(&handle)

    DeallocateBuffers()

    DAQmxClearTask(&handle)

    DAQmxLoadTask(&handle)

    DAQmxCFGInputBuffer(&handle)

    DAQmxRegisterEveryNSamplesEvent(&handle) //register Manager of data (task receiver only)

    AllocateBuffers(&handle)

    StartDAQ(&handle) //called once for each task, called once again after the call to InitTask()

    DAQmxStartTask(&handle) [failure]

    The program successfully call StartDAQ twice at the beginning and starts each two tasks without error. I only get the - 50103 to the DAQmxStartTask () call the second time, I call StartDAQ() for the receiver, after the judgment task, reallocation of the buffers and reloading of the task (which happens without error). Any help much appreciated.

    Hello

    I hope that you had a wonderful holiday season, looking at your code, I think it will take to ensure that you have a task that is running, below I think would be the best way to initialize the task at hand and see if it works.

    DAQmxErrChk (DAQmxCreateTask("",&taskHandle));
    DAQmxErrChk (DAQmxCreateAIVoltageChan(taskHandle,"Dev1/ai0","",DAQmx_Val_Cfg_Default,-10.0,10.0,DAQmx_Val_Volts,NULL));
    DAQmxErrChk (DAQmxCreateAIVoltageChan(taskHandle,"Dev1/ai1","",DAQmx_Val_Cfg_Default,-10.0,10.0,DAQmx_Val_Volts,NULL));
    DAQmxErrChk (DAQmxCfgSampClkTiming(taskHandle,"",10000.0,DAQmx_Val_Rising,DAQmx_Val_ContSamps,1000));

    If this does not resolve your problems I check the example finder and see if any of this code is able to help you.

    Finally, I have two examples of data strings at the same pace and if you have too many samples on a single line you can throw most of these samples.

    I hope this helps,
    Daniel

  • Can I create two tasks of IA using the same unit of data acquisition?

    Hi all

    Sorry for the question of gumby, but I'm new to all this stuff DAQmx, and I'm trying to understand how it all works.

    I use a USB-6229 with LabVIEW 8.6.1.

    I would use 30 lines HAVE to monitor 30 voltage remote signals.

    I would use the other two lines of AI to perform input voltage independent tasks.

    I tried to create and start the two tasks, but I get an error message when I try to start the second task.  He tells me that the resource is not available.

    What is the cleaner way to configure things working for me?

    Thanks in advance.

    -FB

    Hi diarmaede,

    You can only create one task to HAVE on your card. Read all your DO this card in a loop. You can divide the result and send it to different loops to work on it.

    It will be useful.

    Mike

  • How to use the two counters to PXI-6280, to read and write at the same time?

    Hi all

    I try to use PXI-6280 counter to generate a command of step motor pulse train.  The idea is to send a number done and known pulse for the engine, which belongs to a system XYZ. The point is, if, at some point, the user or the security system can interrupt the movement. If this happens (and will be... a lot), I will lose the real position, because I don't know how many pulses were actually sent to the engine. That is why I want to use the other cost to count impulses how were actually sent to the engine. I can start any tasks (generating or account), but only the first started task will operate. I met a couple of mistakes and I'm not able to find a solution.

    Is it really possible to use the two counters? I've already done this in a pci system and worked without problems.

    Thanks in advance,

    Giavonna

    Electrical engineer

    I'm afraid that I don't understand your idea. Could explain you better?

    Material of the series M support pointing to an arbitrary digital signals at rates (the clock must be provided from another source, for example a counter).  If you want a digital pulse train finished output and have access to a counter (the two counters if find you another source for your clock, for example the subsystem "output frequency"), you must use this subsystem 'digital output' rather than the output of the counter.  There should be examples in the finder of the example shows how to configure a finished task of digital output.

    Now I'm generating sample clock having a single Timed material Point (the only mode accepts this mode), and configure the counter with finite samples.

    I don't think not just single point NI the hardware, that's what you want.  More commonly, output meter tasks use timing 'Implied', where the release date is implicitly determined by the characteristics of the pulse user-defined.

    Is there a way to stop the production of only one meter when a finite number of pulses has been played in another counter?

    Yes, but it's a little tricky.  You can set a trigger 'Pause' on the output task, with the soruce the break being the internal release of the counter used for the task of entry.  Set the initial value of the counter of entry to 2 ^ 32-N (or maybe 2 ^ 32-1-N, I don't have a system right now to check) where N is the desired number of pulse output.  Together the counter event behavior for the counter edges of County switch output (this is a property of DAQmx export Signal).  When the counter of entry reaches terminal, its in-house production switches, causing thus the task of output to pause.  You can then stop the task in the software (you should be able to use the output of the task of entry counter event to signal to the software when the output is paused).

    Now that I've written that the whole paragraph, I remember something * similar * to work around a limitation of the driver here .  It is not quite the same implementation I described above, but really, you can use a meter output or a counter entry to get the same effect (it could be a good place to start anyway if you want to try this).

    Is there a way to read pulses them how have been generated, without the other counter, counting impulses?

    N °

    Best regards

  • Timestamp in two tasks data acquisition

    Hi guys,.

    I have a strain gauge and a sensor of movement in two different tasks using two modules different (one for the series) and the other for voltage measurements. I have synced their sharing the master sample clock and a trigger digital beginning. I used an array of index and the Array.vi of time get Waveform for a task to extract the time in a PDM file. I wonder if it is the right way to do it or if I need to define functions of time of wave table get two.

    Kind regards

    StathPol

    I think that each task can have reading as a data type of waveform.  That would give you a boost time, the time between samples and the samples.  With this, you can calculate the time that each sample has been taken.  But if you have written your code to use the same clock that this might be unnecessary.  You say reliable if the equipment works, that the two tasks will use the same clock, and examine every time that the task could be additional work.

  • How to build square 3 ph pulses and use them to trigger the two analog inputs.

    Task:

    1) generate continuous 1 Hz ms 45 pulses on three lines of output offset 120 degrees.

    Other neighborhoods, three phases (three outputs) 120 degrees out, but instead of sine wave should be a volt 5ms 45 along with a second ground pulse. I need these impulses to control an external circuit. The tolerance of 1 Hz is loose, but 45 ms must be at 100 us.

    (2) measure (trigger) two independent DC voltage over 45 ms 50 ms after each front (leader) amount of each pulse. 45 to 50 ms must be 100 us.

    Other neighborhoods, begins each measure 45 ms for the DC source #1 and 50 ms for the source DC #2 after opening (rising edge) of each pulse for total of six measurements per second 1 (by 1 Hz cycle).

    (3) an analog output must provide ongoing (to be booked) negative DC voltage to be used as a source of supply for external circuits.

    I timely when I can generate the 45 Hz by using CO (0) 1 ms pulses continuously and the trigger I (0) on falling edge. I (0) is hard wired to triggering I (0).

    How I do HAVE another (1) and two other lines (two phases) and link them to HAVE (0) and HAVE (1)?

    Equipment: LabView 8.6.2, PCI-6221 (37-pin)

    Hi behappy.

    Thanks for posting and welcome to the forums EITHER! I think we can get what you need with the variety of the 6221 37 pins:

    (1) our machines of the M series have 2 counters, so you cannot generate all the impulses of 3 of these alone. A solution would be to use outputs digital correlated.

    Unfortunately, the 37 pins 6221 has only two IO digital correlated, so you should use a strange mixture of digital meters and IO to implement three impulses. It would still be feasible - for example, you might use a counter for a time base for the digital i/o lines and the other counter to the third output pulse. You would have to match the beginning of the two counters to ensure the phase of your signals.

    2) there are essentially two parts to this question, so I'll try to split:

    (i) combine the three impulses together to generate a single sample signal out of. I think this would be doable on a different set of M with a higher number of digital I/o lines correlated using change detection (see the user manual of M series). However, at this stage, we are just out of digital lines correlated to use, and I don't think that's possible on the 37 pins 6221.

    If you use the 6221 37-pin, which you will probably need to do is to provide your own external circuits OR three pulses together.

    (II) get the 5 ms delay to enjoy your second channel. Since you have already discovered that you can sample the falling edge of the digital signal for the delay of 45 ms, you would just add another delay of 5 ms before taste you your second I. You should be able to do this by setting the clock to convert DAQmx frequency (5ms corresponds to 200 Hz). The clock to convert, it's what actually sampling data (keep in mind that the boards of the M series are multiplexed).

    To do this, simply use the property calendar DAQmx node, then select: more > converted > rate.

    (3) this one is easy - we have not yet used all channels of AO.

    So the 37 pins 6221 is a little less ideal because you have not enough correlated digital i/o to make the generation of pulses or change detection - but he has yet to do the job if you can combine the three impulses yourself outdoors and don't mind not using the additional counter to generate the third impulse.

    I hope this helps, if you need any help to find relevant examples, please do not hesitate to post in return. Thank you!

    -John

  • Two tasks that share the same resource in sequence

    I'm the current exception "the specified resource is reserved.". I understand that you can not run two tasks that share the same resource at the same time. However, is it true that you can not run two tasks that share the same resource, one right after the other, without the eliminate completely from the first task?

    for example

    Task1 and task2 share the same resource
    Task1. Start();
    Task1. Stop();
    Task2. Start(); This will always throw an exception until you have a task1 (i.e. task1.) Dispose()?
    Task2. Stop();

    Hi cafarm,

    You're right, the fact to just stop at one task does not allow that run you another task with the same resources immediately after. That being said, you can start the next task without having to erase or dispose of the first by making use of the task status template DAQmx. As you can see on the next page, stop a task simply going to the State of "Clerks", which means that the material is still used by the task even if she does not actively.

    http://zone.NI.com/reference/en-XX/help/370466AC-01/mxcncpts/taskstatemodel/

    Instead, you can use the control functionality of task for the first task of transition to the status "verified" after stopping it, then start the second task. This keeps the parameters of the task without having to have the task, but it should free up resources to be used by other tasks.
    http://zone.NI.com/reference/en-XX/help/370473H-01/mstudiowebhelp/HTML/verifycommitstartstopdaqtask/

  • 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

  • DAQmx error at the start of task-50103

    Hello, I would like to acquire the data of two lvdt.
    I use a same programming for the two lvdt.
    the different with the two lvdt is in the selection of the entry,
    the mistake of saying at the beginning. I'm trying to make a new
    DAQmx start task, but he also recalled the same thing once again that
    a further task to start. could someone help me please
    so I can start to measure these two data using LVDT.
    I've also attached the program I made.
    Thank you

    LabVIEW version: 7.1
    sensor: LVDT
    Connector: SCB-68
    DAQ CI - MIO 16th-01

    Thank you very much
    now, I got what you mean

  • I'm trying to move a song to my iPhone music library to the iTunes library on my MacBook Air.  I do not want to synchronize the two, so how do I simply copy/migrate the song on my computer?

    I'm trying to move a song to my iPhone music library to the iTunes library on my MacBook Air.  I do not want to synchronize the two (and they have never been synchronized), so how can I simply copy/migrate the song on my computer?  Is there a way to do, without having to re-purchase the song on the iTunes Store on my Mac?

    E-mail (for yourself) click on it in the email

  • I got two sources of camera the same audio recording - how to use multicam to audio synchronization and display TWO cameras simultaneously

    I had two sources of camera recording the same audio - I want to be able to do is use mulitcam SYNCHRONIZE the audio and video at the same time and be able to use the two clips simultaneously in a video - multicam - how can we use the TWO videos? In Multicam, I can only go to one video at a time - is to detach anyway, so I can trim two camera responsition camera and 1 on a 16:9 screen? What would be the best way to do this? Any help would be welcome - Ty

    Two PPut copies the multicam in editing element, one on the other.

  • What is the relationship of synchronization between the input MUX and the clock to convert DAQmx

    My application requires both long settling for the analog input.  I can slow down the clock to convert in order to increase the interval without but I would like to learn more about the internal synchronization and synchronization between the switching of input MUX and the clock to convert.  Data acquisition is USB-6225.

    Thank you

    Neville

    wet'nwild,

    You have reason in the observation that hold all the impulses of the event happening 180ns after convert rising edge clock, regardless of the period of the clock to convert.

    This is the process:

    1. the clock Convert generates an impulse to start the ADC conversion.

    2. a period of time (in your case, 180ns) after the clock pulse to convert, the complete signal hold impulses. This indicates that the data are "required" by the Active Directory Connector. It is now OK for the MUX switch to the next channel. It is important to note that the ADC conversion is not complete when the pulse hold full occurs.

    3. at this stage, the MUX will pass and the device will wait for the next clock pulse to convert for the start of the next conversion.

    In summary, this means that when you change the period to convert clock signal, the complete signal hold flashed always the same fixed amount of time after the edge of signal clock convert. The complete signal Hold'em is not a good indicator of break-in; the width of the period to convert clock must be waiting time indicator (which looks you determined you're previous posts). A good application for the signal keep complete would be for an application where there is an external multiplexer and the multiplexer needs a signal indicating that it is OK to switch the inputs.

    I hope that helps clear up any uncertainty that you have about how it works!

    Kind regards

    Aaron

Maybe you are looking for

  • Re: update by Satellite M30 and RAM

    Satellite M30 - 4 years old - slower than a glacier. Sometimes said "low virtual memory". If increasing RAM help? Currently still got 256MB.

  • The battery does not work well. iOS 9.2.1

    Hello After upgrading my air2 iPad to iOS 9.2.1.  I have no problem with the battery not well like before and in the use of battery battery settings and still maintain the same and does not calculate correctly as in the screenshot ideas how solve thi

  • Problem reading Hameg 4040 via RS232 VISA

    Hello guys! I'm trying to control my Hameg 4040 power through sustainable intensification of CROPS more than VISA (RS232). Writing works well, but the return values of reading do not work. Tried to do a simple Test.vi that puts just in voltage and cu

  • Outlook Express has suddenly stopped saving e-mail sent to my folder "Sent items".

    It's never happened before many years of using Outlook Express. The box 'Save a copy of the messages in the 'Sent items' folder' under Options, send is checked. I tried unchecking and then check that box without success. I also tried to uninstall and

  • 790 with dual Radeon HD 6350 - any benefit to using both on a monitor?

    I have a Dell 790 Office i5-2400 with double cards AMD Radeon HD 6350.  Is there a way, or any advantage to use two cards to power one monitor? I was wondering if I can combine cards to get best performance GPU. So I guess I wonder if Crossfire works