analog output digital start trigger the api c

Hi, I'm trying to start analogue output based on a digital trigger (either PFIO or a PXI line) I can make this easy in LabVIEW.  However with the C API (through the Python wrappers), the problem is when I call DAQmxBaseWriteAnalogF64, writing will always be timeout that the acquisition was not triggered.   However, I can't call it after the trigger occurs, because obviously, it will be too late.

I can't find any examples of C API where the analog output is triggered a digital triggering.  I can find for the analog input, but is fundamentally different that you can CONV read anytime after the trigger occurs.

Python code as follows (functions are equivalent ot C API, even if you have no need of ot pass the task handle such that it maintained as part of the Task object)

# create analog output task
analog_output = Task()
analog_output.CreateAOVoltageChan("Dev1/ao0","",-10.0,10.0, DAQmx_Val_Volts, None)
analog_output.CfgSampClkTiming("",outputRate, DAQmx_Val_Rising, DAQmx_Val_FiniteSamps, numSamples)
analog_output.CfgDigEdgeStartTrig("/Dev1/PFI0", DAQmx_Val_Rising)
analog_output.StartTask()
analog_output.WriteAnalogF64(numSampsPerChan=numSamples, autoStart=False,timeout=1.0, dataLayout=DAQmx_Val_GroupByChannel, writeArray=data, reserved=None, sampsPerChanWritten=byref(samplesWritten))print("Analog output: Wrote %d samples" % samplesWritten.value)# create digital trigger dig_out = Task()dig_out.CreateDOChan("Dev1/port0", "", DAQmx_Val_ChanForAllLines)

# create digital trigger function
highSamples = 1000
numpts = 3 * highSamples
doData = np.zeros((numpts,), dtype=np.uint32)
doData[highSamples:2*highSamples] =  2**32 - 1

# send digital trigger
doSamplesWritten = c_int32()
dig_out.WriteDigitalU32(numSampsPerChan=numpts, autoStart=True, timeout=1.0, dataLayout=DAQmx_Val_GroupByChannel, writeArray=doData, reserved=None, sampsPerChanWritten=byref(doSamplesWritten))
print("Digital output: Wrote %d samples" % doSamplesWritten.value)

Hi PatrickR,

You can review examples of code NI-DAQmx (ANSI C) text based on the production of an output using a trigger to start digital analog. If you included/checked support textual dusing your NI DAQmx driver installation, you can navigate to Windows start > all programs > National Instruments > NI DAQ > Teaxt-Based Code support > ANSI C examples > analog output > generate voltage > Mult Volt updates-Int Clk - Dig start. If you have questions/doubts about the material.

Tags: NI Hardware

Similar Questions

  • How to set the digital format via the API

    Hello

    I have a utility that imports limit of external resources and that the utility (c#) I would need to change the digital representation so that what is defined as hex in the external resource should appear after imported to TS so hexa.

    Can U help out me if it is possible with the API, and if so, what is the good methods for doing this?

    Thanks in advance.

    Hello

    Only a few minutes ago, we have found this solution work:

    x.NumericFormat = "%#X";  where x is the PropertyObject pointing to the number. It is just not documented anywhere for this method that you can use X for hex.

  • Do not connect ANALOG and digital grounds when the annotation to the front at the UB

    I'm finding randomly more often when I annotate with impatience to UB analogous and digital patterns do not connect.  In addition some power to the IC pin connections are unable to be connected in UB.

    Connect to the digital terrestrial analog ground is checked in my properties of Ms.

    Is there a reason for this?

    Thank you.

    Tien Pham offers this solution that worked:

    I saw the ground issue in the file you sent and you can fix it by replacing
    the digital ground with the one from V12.  On the Spreadsheet View, click
    on the "Components" tab, select all the Dgnd symbols, next click the
    replace icon on the Spreadsheet to replace all symbols at the same time.
    
  • Getting started with the api perl?

    Hello

    I'm after a pointer or two in the right direction to start with the perl api for vmware - I have read around and ended up do not know on what api should I use. The ESX environment is v2.5.

    My requirement is to collect performance data of the computer (cpu/mem/disk/net) virtual guests and some configuration data (disk to lun map/mem & cpu allocations etc.).  I say this only in case it affects the choice of the API.

    I've also seen some docs/examples of scripts that mention a list of attributes that can come from the guest - these come completely out somewhere just in case I need more later?

    I've seen talk about vSphere cli for perl 4.0 (sounds weird like perl 5.x now), also version 1.5 and 1.6 of the perl api.  VIX too.  I guess that vmware have changed the names that they develop products, but since I was at the VC 2.5 I know of course at what point in the cycle of life, I should be in.  If there is a readme file that explains this lot just let me know.

    Thanks in advance.

    First of all, definitely take a look at this page: http://communities.vmware.com/community/developer/forums/vsphere_sdk_perl in the section of the resources on the right.

    It is a large document showing you the details of how the perl Toolbox not Accon vSphere SDK for Perl, really worth to go through the documentation:

    http://www.VMware.com/support/developer/viperltoolkit/doc/perl_toolkit_appliance_idx.html

    If you are familiar with the esxcfg-* commands, whereas you'll notice through the vCLI/RCLI, which uses the vSphere SDK for Perl has the same exact command set but the installer to help make managing remote:

    http://Engr.UCSB.edu/~duonglt/VMware/#vmware_rcli

    http://Engr.UCSB.edu/~duonglt/VMware/#vmware_vcli

    There are additional utilities that come with the vCLI/RCLI, take a look here for list:

    http://Engr.UCSB.edu/~duonglt/VMware/#vmware_viptk

    As you know, these are all Perl scripts, which means that you can open them and see how it is implemented and how they use the vSphere API, the reference for the API doc is also very important as:

    vSphere 4.0 - http://www.vmware.com/support/developer/vc-sdk/visdk400pubs/ReferenceGuide/index.html

    VI 3.5 - http://www.vmware.com/support/developer/vc-sdk/visdk25pubs/ReferenceGuide/index.html

    I think the best way to learn it is to start playing with some of the scripts canned and to make it even easier to have an environment that is all set up for you with the vCLI and vSphere SDK for Perl, you can download the vMA that is a management assistant from VMware to remotely manage your systems (i) ESX and vCenter.

    The version of Perl that is used is in fact 1.6 but the designation of vCLI is 4.0 which is in conjunction with release of vSphere 4.0, it has nothing to do with the version of Perl (Yes the naming/numbering really sucks and confuses a lot of people)

    Here is a nice document that made the breaking of all the various API/SDK/etc.: Getting Started with vSphere SDK - Update for SDK 4.1 release

    VIX is the main for the management of comments, it is intended to be used or can be used in conjunction with the vSphere API and you can find more information on the VIX.

    Also, here is a code example for vSphere SDK for Perl: http://communities.vmware.com/community/developer/codecentral/vsphere_perl and vGhetto scripts repository

    Well, I'm sure it is a handful of information and it will take some time to digest, but still the best way to learn is to start playing with it and you'll get a kick for him.

    Good luck and happy to script

    =========================================================================

    William Lam

    VMware vExpert 2009

    Scripts for VMware ESX/ESXi and resources at: http://engineering.ucsb.edu/~duonglt/vmware/

    repository scripts vGhetto

    VMware Code Central - Scripts/code samples for developers and administrators

    150 VMware developer

    Twitter: @lamw

    If you find this information useful, please give points to "correct" or "useful".

  • How can I check if the counter entry is synchronized with the analog output?

    Hello

    I'm working on an application for counting photons.  I use two channels of analog output on a PCI-6713 card to send a frame model to a set of XY scan mirrors.  I then a photon count unit that emits a TTL signal when the photons are detected as a result of this raster analysis.  I then use a surfboard USB-6211 to count the edges on this TTL signal.

    I have problems that seem due to synchronization problems.  I use the sample AO on the PCI-6713 card clock like the door of my meter on the map USB-6211.  I use a trigger to start digital to analog output and a trigger of arms for the entrance to counter early. Is there a way to check that the analog output and counter entry of start of operations at the same time and are are synchronized?  I basically want to monitor and compare the ao real sample of the PCI-6713 card clock door signal used by the jury of the USB-6211.  I was able to export the sample AO clock and watch it on my oscilloscope, but not the signal from the door of the USB-6211.

    Thanks for your help,

    Brian

    Update... It turns out that there is no problem of synchronization between my meter input and the analogue output.  There was a difference of impedance when I connected my unit of counting photons to my USB-6211.  This caused an error variable count rate.  After accouting for this shift, the problem disappeared.

  • NEITHER 6052e: can I re - route the analog output of DAQ for PFI?

    Hello

    Does anyone know if it is possible to route analog output to one of the PFI (e.g. PFI0)? I use NEITHER 6052e and I would do the following: 1) output a signal to DAQ0; 2) then a few hundred milliseconds a signal of DAQ1; and then 3) read out a simple analog pulse on any output connector external to trigger an external device.

    Thank you very much for your help!

    Hello sometimes.

    Could you please provide more information about your hardware configuration:

    What devices are DAQ0 and DAQ1?

    Are you using a PXI and PCI 6052?

    When you say AO reroute to PFI do you mean you're trying to wire AO into a PFI line for release purposes or are you trying to exit and the analog signal of a PFI line?

  • generate a square on the analog output wave

    I use a PXI-6229 DAQ card and I need to generate a square on ao0 wave.  I'm programming in c# and have found an example of the expedition, which generates a sine wave.  I need to be able to modify the function generator that was provided with the example of the expedition to produce a square wave 7.2 kHz with duty cycle of 50% and 2 v peak-to-peak.  I enclose the code generator to function.

    Thank you

    After a lot of trial and error and adapt the example to generate a sinusoidal signal, I have the solution to generate a square signal of analog output.  I enclose the code.

  • the time of acquisition of data - how to calculate the rate of analog output

    I want to calculate an acceptable rate of analog output, one that is taken in charge by material (PCIe6353), without the rate being changed by the VI DAQmx Timing (sample clock). The final objective is to have a rate of analog output that is an integer multiple of the analog input for precise frequency, since the sinusoid AO's amplifiers, which have a ringtone when AO updates occur.

    According to 27R8Q3YF of the knowledge base: how the actual scanning speed is determined when I specify the rate of scanning to My d..., the rate is revised as needed by calculating the rate of clock / asked for advice, divide the result rounded downwards and upwards in the clock of the Board and use the one that is closest to the requested speed.

    If 'Embedded clock' is selected, which is the result "Council clock.  DAQmx sample clock timebase Timing node - SampClk.Timebase.Rate says 100 ms/s. However, for a rate resulting from the update of 2.38095MS / s, the divisor of the time base timing node - "SampClk.TimebaseDiv" gives a value of 42. 42 x 2.38095 M = 99, 999, 990, where it should be 100 ms/s.

    How to calculate an acceptable rate of analog output is supported by the hardware? I have other plates, in addition, a general method would be appreciated.

    I haven't worked all the details yet but noticed a few things that may be relevant.

    Req AI rate isn't a whole ditch 1E8. It is used to determine the rate of the AO.

    There is no check to ensure that the rate of the AO is an integer division.

    It seems that you have the right idea, but the implementation is not yet there.

    Lynn

  • analog-to-digital

    Hello, please how to convert an analog output digital, I'm working on the cRIO 9012.


  • Read analog output channel value internally

    According to this you can read the values of analog output of return without having to physically connect the wires.

    By using the technique described in the example given (DAQmx_Read_Output_Internal_Channels.vi) I'm reading a current area of OCCUPANCY on my compactDAQ cDAQ-9174 with a module of analog output current OR-9265.

    The output channel is created in MAX and my vi can write values to him without problems

    But when I try to create an analog input channel to read the output, an error occurs.

    What I am doing wrong?

    This is not supported by my hardware?

    Or is the example given in the above incorrect link?

    The example is 10 years old. Maybe, it does not work in LV2013.

    Hi Jocker,

    The link was not attached to your message, but I guess that's it: http://digital.ni.com/public.nsf/allkb/CB86B3B174763C3E86256FFD007A2511 as there the example of vi you mention.

    The error you are getting is due to the use of the channel for analog output and trying to configure the task as a task of entry. You must use _aoX_vs_aognd as the channel of the task rather than on the output channel. This compares to the ground for the analog output values.

    The NI 9265 is not on the list of the C Series modules that have internal channels:

    http://zone.NI.com/reference/en-XX/help/370466W-01/mxdevconsid/9211interchan/#GUID-E13ADE46-5CB8-491...

    So I guess that the module is not able to compare its output to ground. He would appear in the dropdown of the channel names if available.

    Pete

    Applications Engineer OR

  • Analog OUTPUT material

    Hello

    My question is about the analog output (0 - 10V) of the myDAQ unit.

    On the card, you can read:

    "Overdrive Protection +-16 V forever."

    Lets imagine the worst case: 0 V output DQA, but outside a battery or anything else is connected with 15 V to the analog output.

    Fact an "unlimited" current in data acquisition or protection 'Overdrive' works here and the material is safe to destroy?

    The background: I want to OD are protected from transient voltages and toilet on a simple zener diodes clip or a tvs diode...

    Thank you all, Markus

    Markus,

    To use a zener diode as protection, you must also have an impedance of current limiting in series with the source against which you are protecting.  The manual for the device of maDAQ indicates that the lines of the AO are pushed by OPA1642 op amps.  TI the MSDS for this unit shows the current limiting internal ~ 36 my short circuit with Earth and a thermal shutdown circuit that tries to protect against the terms of overpwer.

    However, under your 15 V battery, 11 V zener and 0 V programmed DAQ exit, the situation may be different.  The current from the battery through the zener will be limited by the impedance of cables or any type of resistance on the line.  This has no direct effect on the myDAQ device, but it will probably destroy the zener unless resistance limits the current to a lower maximum current nominal zener.  As long as the voltage at the output of the myDAQ is lower than the internal supply voltage (+/-15 V), on the OPA1642 current limitation should apply.  With 11V applied to the output and the value set to zero the device would probably be to try to sink the maximum current for-15 V power supply.  Which translates to a dissipation of power of more than 900 mW, which exceeds the rated capacity of the op amp. Themal protection should, in principle, reduce the current to a level that does not exceed the thermal limit under development.

    This test can be a costly process. The unit may be destroyed.  Given that the maximum current specified for an analog output channel is 2 my and the maximum voltage is 10 V, I would consider a series resistance of perhaps 1000 ohms and clamping schottky diodes at the + 15 V and - 15 V power supply.  This will limit the current to 10-20 my in all conditions you have mentioned and would also provide protection to the case where the battery is connected the myDAQ device is turned off. He alsoe does not care about the polarity of the external source.  It will drop the output voltage according to the load impedance.  If this should be used in a student lab, the calcualtion of this decline is something they should be doing anyway, and would be a small price to pay for protection.

    Lynn

  • How to trigger and outputs analog and digital Outout tasks begins on a counter to start?

    Hello

    I'm trying to synchronize the start of a task outputs analog, a task of digital output and a task of counter. I want to start the counter to serve the master trigger and analog and digital tasks to synchronize his departure.

    I guess I need something like:

    analogOutputTask.Triggers.StartTrigger.ConfigureDigitalEdgeTrigger ("?", DigitalEdgeStartTriggerEdge.Rising);

    digitalOutputTask.Triggers.StartTrigger.ConfigureDigitalEdgeTrigger ("?", DigitalEdgeStartTriggerEdge.Rising);

    analogOutputTask.Start (); Slave 1

    digitalOutputTask.Start (); slave 2

    () counterTask.Start; n / / master

    Where? is a string specifying a command source for the beginning of the task of the meter. However, I can't find what this string. Any suggestions?

    Thank you!

    -Jon

    Just FYI, the solution to this problem as well as some other ones is encapsulated in a short example .NET, I created. It is on the Web site of EITHER:

    http://decibel.NI.com/content/docs/doc-15500

    This project shows how to synchronize all your analogue/digital outputs through tasks and forums in terms of synchronizing Calendar and start clock.

    -Jon

  • Trigger start analogue does not work for the tasks of the analog output

    Hello. I wonder - what someone has tested the trigger mode analog start for continuous output voltage-. example of VI under hardware input and output - analog output folder in the Labview.

    My camera's SMU-6358, who has two lines APFI and supports analog trigger. Although it is very difficult to find information on the use of analog trigger for analog output of the tasks, what I've learned so far is to connect the interested analog trigger signal (such as an external noise) on both the AI channel which is used as a source of relaxation (ai0 in my case) and a two-channel (APFI0 in my case) APFI.

    During the test the example above vi, any level of relaxation that I put (even with 0), the task of output did not work at all. No error message is returned either. Just for your information, I do physical tests, not only the software simulation, so no signal means no signal.

    Any help is appreciated!

    I have here is that the solutions to this issue, just want to say thank you to all who have helped me on this subject.

    Use the analog analog trigger output tasks, make sure that the trigger signal (input HERE) is connected to APFI0. There is no need to connect the trigger even signal to ai0 if you do not want to save the trigger signal. However, if you do not want to save the trigger signal, connect the trigger signal to both ai0 and APFI0 with a signal splitter. In the latter case, the task of the AI shouldn't take the same trigger that the task of the ao. This means that you can start your registration with or without a trigger, while leaving the task of ao wait a trigger of some signal. This is useful in a situation that you only want to generate ao task to a certain trigger event, as when a signal reaches a certain level of sound pressure.

  • How can I impliment a delay between the analog output and analog input (started by an external analog trigger)?

    I am acquiring several channels of analog voltage input at the same time, I need to send an output analog two seconds after the start of the entry.

    I'm running an experience with accelerometers on a query table.
    I start the trigger and the table remains still for two seconds, which allows a reference level for all sensors.
    Then the output signal of the VI removes the break in the motor controller.
    The speed measured by the encoder is sent to one of the input channels.

    In this way, our accel and speed data are synchronized.

    After it acquired the analog input data out put must be reset to zero.

    MULTI.vi

    I've updated the link above works of VI, I used a property node to solve the problem.

  • Synchronization of analog and digital output with the external sample clock

    Hello

    First of all sorry for my English, I will try to explain what I want to do.

    I want my PCIe-6321 to send two custom signals (modification sawtooths) on a mirror controller. I would also like to generate output with my card at the beginning of each tooth of saw. Everything must be synchronized with an external k-clock signal of 100 kHz. The idea is that whenever the PCI receives a trigger to external clock, it sends two analog output voltages and when he received 1024 clock ticks it will also send a pic of triggering TTL. What I do is first prepare the map and after that in a loop sending and modifing the output values of the two signals and at the same time send a digital signal Boolean in each arch, so when's done it 1024 iterations of the loop I send an event to the digital port. Attached you can see.

    The problem is that I don't know how to synchronize both. Can I use the sample clock just to the analog output? I can use sample for the two outputs clock, or do I need to use the output of the meter? If don't know how to use it here.

    If I do nothing else bad/wrong, I would be grateful for feedback.

    Thanks in advance,
    Pablo

    I don't know how but I find the solution. I'm generating more than a positive value (as I was triggered maybe very fast the oscilloscope has been absent there). If I put the sample clock of digital output to use the sampling/ao/Dev1 clock that it doesn't, but if I put to use the same source as the OD (terminal where my external clock is connected), but the trigger to start the DO to be Dev1/ao/StartTrigger this works. I don't really know why, but it does.

    Thank you for your patience and your help. I put here the final code.

Maybe you are looking for