Setting analog outputs to 0

I would like to start by cautioning you that I am not a programmer.  I have been trained in LabVIew basics, so naturally I am trying to write a much more than basic code. 
I am writing a test sequence in which I am using a sequence structure to setup and sequence various test functions. For part of the code I am writing I am trying to control a pressure output, I start the task outside a while loop, I write to the task to control control pressure inside the while loop after leaving the while loop and then stiop the task outside the while loop, but the analog output remains at the last commanded value, how do I set it to 0? 
I have tried writing a constant 0 to the task after I leave the loop and then stoping the task but this does not appear to work. I have a number of analog and digital outputs in this code that I would like to set at 0 before I proceed to the following sequence. 

My appologies, I have been going through a number of trial and error phases with this code.  Here is an example of when I was trying to write a 0 to the channel, in this version I used a case structure to tell it to go to 0 when the test sequence would be complete.  I arrived at this potential solution after having no success with earlier attempts. 
As far as state machines go, like I said I have only been to LabView basics I and II, would I be able to convert the sequence structure to a case structure and put that in a while loop of some sort to control the sequencing?
Attachments:
Purge Portion 15.vi ‏59 KB

Similar Messages

  • Setting different analog output's parameters in PCI-6229 DAQ card

    Hello,
    We are using DAQ assistant to set the analog output parameters (frequency).
    Is it possible to set different values for each channel using DAQ assistant?
    If not using DAQ assistant, what  is the other way to set it?
    Thank You
    Arunas

    If you are trying to set different frequencies for waveform generation on two channels, the answer is No, it can't be done. If possible, you will have to pick a sample rate high enough to work for both signals, and use an over-sampled waveform.
    Another choice would be to use a second device for the second waveform.
    John Weeks
    WaveMetrics, Inc.
    Phone (503) 620-3001
    Fax (503) 620-6754
    www.wavemetrics.com

  • Setting sample rate for sinus analog output

    Hello,
    I've been trying to do something very simple : using an analog output of the card PCI 6221 to produce a sinus curve of frequency 50 Hz. For this I used a Vi to create a sinus curve and the different DAQmx VIs. But I have difficulties understanding the principle of virtual channel and I think I'm doing a mistake setting the sample rate and samples number : one time for the sinus vi, second time for "DAQmx - Timing". Should I use the same values for both of these VIs ?
    On my oscilloscope, with frequency=50Hz and sample rate=1kHz, I get a null signal. Then depending on both values, I get differently rated signals. For example with f=1Hz and sr=10kHz, a sinus of frequency 0,7 Hz.
    Solved!
    Go to Solution.
    Attachments:
    Sinus analog output.vi ‏32 KB

    Yes, thanks for your advice. I used the structure given in the example and now it's working fine. I'm still not sure what I did wrong though.
    I would have a second question now (should I create a new topic?):
    I put a continuous sine wave on the analog output. As soon as this is running, (or maybe after a short delay) I want to measure a limited amount of samples on my analog input. How can I be sure, it's not going to start measuring before the output is properly set ?
    I don't think a trigger would solve the problem since I'm going to vary the output Amplitude.

  • Set default analog output in MAX

    Hi,
    I would like to set a default value (e.g. 10V) to my analog output of my NI6251 card. The current value is (I assume) 0 V.
    Is there a way to change the default value without using labview?
    Many thanks

    I'm pretty sure you can't set the default analog output of a DAQ card to something other than 0V even using LabVIEW.  When the device powers up it will reset and set all outputs to an inert state which is a good thing for safety conserns.  
    I'd recommend you redesign your system so it too uses this standard of using the inert state of a startup condition.  What kind of system do you have that you want the off state to be 10V?
    Unofficial Forum Rules and Guidelines - Hooovahh - LabVIEW Overlord
    If 10 out of 10 experts in any field say something is bad, you should probably take their opinion seriously.

  • How to switch analog output between two waveform frequencie​s

    Hello,
    I'm using a fairly simple VI to generate a square wave at our analog output board.  I have the square wave controls in one panel of a sequence structure, and a "release" function in the other panel of the sequence. Currently the VI is programmed to switch from the original square wave to -10V when the Boolean control is switched.
    What I'd like to do now is to modify the VI so that I can swtich between a square wave of a given frequency, say 100 kHz, to a square wave of a different frequency, say 10 kHz, or to DC -10V. But I'd like to be able to vary each frequency and amplitude independently.
    Could anyone give me some programming pointers?
    Thanks,
    Michelle

    Thanks to the three of you for the suggestions. I started trying a few of them, and then realized that what I had already built will work pretty well to update the frequency. I didn't realize that it would update the waveform in "run" mode -- I thought it would only do that in "run continuously" -- so I've found that I can change the frequency of the waveform by doing that. This doesn't allow me to change the frequency and the amplitude simultaneously, but I'm not sure yet whether or not I will need to do that -- I so will probably go ahead with the experiments I need to do with this set-up, then modify it if I find that I need to control both frequency and amplitude simultaneously.
    Thanks for your help!
    M.

  • NI-DAQmx VisualStud​io C++ 6 Single point analog output

    Specs: NI-DAQmx 7, VisualStudio C++ 6.0,  PCI-6722,8channel AO
    We have a very simple application: set a voltage (actually 6 channels) and keep it until we want it changed again, perform the change very quickly in response to an image capturing algorithm. So I don't need any waveforms or buffering.
    In this forum post http://forums.ni.com/ni/board/message?board.id=231​&message.id=3283&query.id=18094 you talk about an AOOnePoint example, but I get an error that the NI-DAQ driver does not support my device.
    I may need to use NI-DAQmx, but how? I would like to use something like AO_VWrite(,,), maybe for 6 channels in one call. But I can't find it in NI-DAQmx. It seems I need to setup buffers and frequencies. I have a working sample, but it seems a slow and certainly overkill of this simple application:
    // Link with \DAQmx ANSI C Dev\lib\msvc\NIDAQmx.lib
    #include "NIDAQmx.h"
    double[2] data;
    int taskHandleAnalog;
    int written;
    void Init()
        DAQmxErrChk (DAQmxCreateTask("",&taskHandleAnalog));
        DAQmxErrChk (DAQmxCreateAOVoltageChan(taskHandleAnalog,"Device and Channel Info","",0,10,DAQmx_Val_Volts,NULL));
        DAQmxErrChk (DAQmxCfgSampClkTiming(taskHandleAnalog,"",1000,DA​Qmx_Val_Rising,DAQmx_Val_ContSamps,NUMBER_OF_AO_SA​AMPLES));
        DAQmxErrChk (DAQmxWriteAnalogF64(taskHandleAnalog,NUMBER_OF_AO​_SAAMPLES,0,1.0,DAQmx_Val_GroupByChannel,data,&wri​tten,NULL));
        DAQmxErrChk (DAQmxStartTask(taskHandleAnalog));
    void SetVoltage( double voltage )
        data[0] = voltage;
        data[1] = voltage;
        DAQmxStopTask(taskHandleAnalog);
        DAQmxErrChk (DAQmxWriteAnalogF64(taskHandleAnalog,NUMBER_OF_AO​_SAAMPLES,true,10.0,DAQmx_Val_GroupByChannel,data,​&written,NULL));

    Hi,
    It looks like you simply wants to output voltages on the analog output channels, but only wants one update at a time with no waveforms or buffering in DAQmx.
    As I'm sure you know there are really just 3 types of measurements.  Single Point, Finite, and Continuous.  Since you want a single value at a time it's just a Single Point operation.
    You can find DAQmx examples for single point operations in this path:
    C:\Program Files\National Instruments\NI-DAQ\Examples\DAQmx ANSI C\Analog Out\Generate Voltage\Volt Update
    Simply place the DAQmx Write Code within a loop and you will be updating one value at a time, but multiple times when "we want it changed again".
    Dennis Morini
    Field Sales Engineer
    National Instruments Denmark
    http://www.ni.com/ask

  • Single shot analog output: How to pulse this. Probably easy, I'm at a loss.

    Hello.
    I have a piece of machinery that my system is connected to.  Every time it reaches a proximity sensor (It's a reciprocating unit), I need to do a single pulse of 5v out of my analog output.  It has to be fast, it has to stop until the sensor is reached again, and it can't stay 'on' for long.
    I've attached my VI.  I'm using a voltage input via DAQ assistant, routed through some logic to produce a 'true' boolean every time that sensor is reached, and that boolean is connected to a case structure with voltage out tasks created in DAQmx.
    My problem is that the machine won't reverse while the case is still true and there's still the 5v being called by the true case on the case structure.  It has to pulse, then stop, then be allowed to come back when the proximity sensor is reached again.  As it is now, the machine reaches the prox and then the whole system stops, as the 'true' condition on the case structure, and subsequent voltage output, remain high.
    I've attached the VI and heirarchy as well.
    I've tried a few different things here, as well as just using a DAQ assistant with N samples, but that would just retrigger when the loop repeats anyway.
    I'd love to sit and bang my head against this til I get it, but I'm under a time constraint.  Help!
    Still confused after 8 years.
    Solved!
    Go to Solution.
    Attachments:
    using create channel.vi ‏94 KB
    logicsub.vi ‏32 KB

    Ralph, without knowing the exact DAQ card that you are using, it is difficult to give you the best solution. If you want to continue with the solution that you currently have, try adding a shift register to the outer while loop to track the previous value of the boolean. In this way, we can keep multiple values that are above the threshold from causing multiple pulses. Next add a time delay after the DAQmx Write, then add another DAQmx Write to set the output back to your low value. Remove all code from your "false" case. See attached VIs. Please let us know what model of DAQ card you have as we may be able to do something clever like a retriggerable pulse train if your card can support it.
    Charles Chickering
    Charles Chickering
    Architecture is art with rules.
    ...and the rules are more like guidelines
    Attachments:
    using create channel.vi ‏98 KB
    logicsub.vi ‏29 KB

  • Synchronizing Analog Output to Counter Input

    Hi!
    I'm really new to LabView. Pls help!
    I'm trying to obtain a set of stimulus signal and response signal from my motor for system identification.
    The stimulus signal will be generated by the Ao0 channel and response signal (quad encoder linear position) will be read into counter0.
    How can I synchronize the stimulus signal and response signal so that the sampling (n samples) for both stimulus and response starts at the same time?
    e.g.
    t=0, stimulus sample 1, response sample 1
    t=1, stimulus sample 2, response sample 2
    t=2000, stimulus sample 2000, response sample 2000 
    I've attached my VI.
    Thanks. 
    Regards,
    Student
    Attachments:
    Acquiring Linear Encoder Samples.vi ‏44 KB

    Hello Htp,
    What do you mean by synchronize? Do you want to start the analog and counter outputs at the same time? If you do, you should have both outputs start with the same digital trigger. For the analog output, you can set up the triggering in the DAQ Assistant in the Task Triggering tab. For the counter output, look at Gen Dig Pulse Train-Continuous-Dig Start.vi found in the Example Finder (Help Menu>>Find Examples). Browse Hardware Input and Output>>DAQmx>>Generating Digital Pulses. Please let me know if you have any questions. Have a great day!
    Sincerely,
    Marni S.

  • Simultaneous analog output

    I am using PCI-6052 with (LabVIEW) .Where two analog outputs are available ,DAC0 and DAC1.I want to simultanouly output the different waveforms on each Channel at the same time.Time is important.
    I tried it with two DAQ assistance vi's setting each channel on each vi ,but at time randomly one vi's gives output not both at the same time.
    Thanks
    Haider

    Hello Haider,
    It sounds like you are trying to get started with NI-DAQmx and want to
    output separate signals on the two analog output lines.  The
    restriction of the hardware is that all of the analog input or output
    channels must be contained with in the same DAQmx Task.  There are
    a couple ways to do this. 
    If you want to stick with the DAQ Assistant, I searched our KnowledgeBases and found the following example program which does analog output for two channels using the DAQ Assistant. 
    If you would like to drill down a little farther and use the lower
    level DAQmx VI's, I would recommend looking at one of the shipping
    examples, the format for multiple channels is Devx/AOy:z where x is the
    device number, y is the starting AO channel, and z is the final AO
    channel. 
    Also, another good reference, especially if you are going to use the lower level VI's is the Learn 10 Functions in NI-DAQmx and Solve 80% of Data Acquisition Applications Tutorial.  Hopefully,
    that'll get you going with your program.  Let us know if you have
    any other questions with either the online example or one of the
    shipping examples. 
    Regards,
    Micaela N
    National Instruments

  • How do I get an analog output signal from my PCI-MIO-16E-4 card?

    I need an analog output from 0-10 V to control the mass range on a mass spectrometer. Do I use the DAC0out channel to do this? The manual only talks about analog out (ao) channels. Is this the same as DAC0out and DAC1out? How do I set up the DAQ assistant for this process? I do not need a waveform, only a constant signal.

    Yes indeeded. The DAC0out and DAC1out are the analog output channels (ao0 and ao1).
    Simply follow the examples that ship with LabVIEW. You can also easily create code with DAQ assistant.

  • Read Data (ASCII) and send to analog output

    Hello
    I have the following MAX configuration:
    Analog input task, continous, 2 samples, rate 100Hz (PCI-6024E)
    Analog output task, continous, 64 samples, rate 100Hz (PCI-6723)
    The cards are synchronized by the RTSI bus.
    With Dasylab I display signals from load cells by the input task. A "Read Data" module sends values to the output task. The "Read Data" module has the following settings: Output in realtime, synchronisation with analog input task, file is an ASCII, block size 4 values, no ascii time channel.
    Additional settings for DAQmx are done by DasyLab:
    Analog input: Driver buffer 30
    Analog output: Driver buffer 30, output start after 2
    When I start DasyLab I get a DAQmx failure (after a couple hours): DAQmxReadAnalogF64, Attempted to read samples that are no longer available. The requested sample was previously available, but has since been overwritten.
    Could anyone please explain, how to configure analog input/output task and the DasyLab settings (Read Data)? - Attached the DasyLab diagram.
    Additional information: The application should read and display signals from a test bench (load cells). The output shall feed external controllers. The input and output signals shall be displayed on the same chart (as realtime as possible).
    Thank you
    Regards Samuel
    Attachments:
    DasyLabDiagram.png ‏67 KB

    Thanks for the prompt reply! - I have changed the settings to the following:
    Analog input task, continous, 16 samples, rate 100Hz, driver buffer 32
    Analog output task, continous, 16 samples, rate 100Hz, driver buffer 32, output start after 32
    In the "Data read" module the block size is now 16 at 100Hz
    With this setting, DasyLab runs, but only for around 12 hours.
    The following error occurs:
    "Read date module name" / The data flow is blocked by one of the following modules.
    Followed by:
    Attempted to read samples that are no longer available. The requested sample was previously available, but has since been overwritten.
    Is there something else I have to care? Could it be problematic to send signals from different modules to the same Chart Recorder module? I use DasyLab version 11.
    Samuel

  • I am using an NI PCI 6024 E board device for an analog output application. Can I generate two independent waveforms, one on each analog output channel?

    I am using an NI PCI 6024 E board device for an analog output application. Can I generate two independent waveforms, one on each analog output channel? In attach I send a example of my vi to control one chanel, but i need to control both but with diferent waveforms.
    Is the vi correctly programed to this propose?

    Yes you should be able to do that. look at the signal generation examples shipped with LabView
    You can create a 2 D array, with each row representing a wave form per channel. The number of points of the wave form (per row of the 2 D array) represent the number of points in the output buffer
    The wave forms can have different amplitudes/shapes, and therefore they are independent in this sense.
    However, you need to set the update rate,which is the same for both channels. The update rate together with number of points per buffer determines the frequency of the wave forms. This means the two wave forms will have the same frequency.
    To have different frequencies, you need to have say, on wave form with one cycle per buffer, and the other waveform have 2 cycles
    per buffer. in a case like that the frequency of the second channels is twice that of the first channel, and so on
    The two wave forms are then not truly independent, they may have different amplitudtes/shapes, but related in frequency.

  • How can i deliver a single pulse of varying amplitude using Analog output and USB-6251?

    I am trying to generate an analog output for the following waveform:
    Pulse width: 300 usec, Frequency 40 Hz, Amplitude is following a sine wave with a 2 second period.
    My approach is: Use an async timer with 1/[40 Hz] sec  interval. I set the DAQ output rate at 1 MHz and the approach has been to generate and write 300 samples of the amplitude I need to send out, then wait for the next async interval callback , update amplitude etc etc.  The assumption is that once the 300 samples are written and the task started , a 300 usec pulse would be sent out , task then stopped and then the analog output would be set to 0 waiting for he next pulse.  The reality is that I get a stream of pulses of 300 usec which last the whole timer interval. 
    So , trying to establish whether what I am trying to do is feasible without actually sending a large array to the USB-6251 which would write zeros for the period after 300 usec.
    Here is my timercallback code for review:
        switch (event)
            case EVENT_TIMER_TICK:
                DAQmxErrChk(DAQmxStopTask(TaskAnalog));
    Determine Voltage value algorithm here
                //Generate Waveform and start Task
                //Prepare AO arr
                for (k=0;k<300;k++)
                    AOArr[k] = 0;
                    if (k<G_PulseWidth)
                    AOArr[k] =  VOLTAGE_OUTPUT;
                if (AOArr!=NULL)
                    DAQmxErrChk(DAQmxWriteAnalogF64 (TaskAnalog, (int32) 300 , 0, DAQmx_Val_WaitInfinitely, DAQmx_Val_GroupByChannel , AOArr, &sampsPerChanWritten, NULL));
                DAQmxErrChk(DAQmxStartTask(TaskAnalog));
                break;
    Thanks

    I did resovle the issue I encountered. It was due to bad configuration of the Task.
    My initial configuration was:
    DAQmxErrChk(DAQmxCfgSampClkTiming(TaskAnalog, "",1.0E+06, DAQmx_Val_Rising, DAQmx_Val_FiniteSamps , 300 * 1.0E+06));
    which should be:
    DAQmxErrChk(DAQmxCfgSampClkTiming(TaskAnalog, "",1.0E+06, DAQmx_Val_Rising, DAQmx_Val_FiniteSamps , 300));      
    THis did it. works very well.
    THanks

  • Buffered analog output puts out additional sample on aborting or stopping task

    I'm using DAQmx and LV 8.2
    I'm doing a buffered analog output operation where the sample clock is driven by pulses from ctr0 on the same device (PXI-6070E).  When I end the analog output task, either with the DAQmx stop task or DAQmx control task (abort option selected), the AO puts out one additional point from the buffer.  (I have checked by setting breakpoints and stepping through the code that the additional point is definitely generated when the analog ouput task is aborted)
    I need the output to remain where it was before the stop task command is issued.  How do I fix this?
    Thanks,
    Marc

    I'm watching to see if there hasn't been a sample output in a certain length of time, then terminating the task if there hasn't been.  Specifically, I have ctr0 outputting pulses to drive the task based on input from the AnalogComparisonEvent terminal.  I'm using a counter on a different PXI device to count the number of pulses and monitoring this count to determine if another sample has been output.  I'm outputting the ctr0 pulse to PFI3 as well, and I'm monitoring both the ctr0 output (which drives the ao clock) and the analog output itself on an oscilloscope.
    Basically I'm sitting in a while loop waiting for the monitoring counter to fail to increment.  Then I terminate the while loop and stop the analog output task.  I can watch the analog output on the oscilloscope while I step through the program.  Immediately before the daqmx control task - abort (or daqmx stop if I don't abort first, or daqmx clear, if I don't abort or stop) vi runs, the analog output remains outputting the last sample.  Immediately after the abort, stop, or clear, the analog output advances one sample in the buffer. 
    During this time, ctr0 does not output another pulse, so the scan clock should not advance.
    Thanks,
    Marc

  • How to reset buffer pointer for analog output generation?

    I am doing a finite analog output generation on a USB-6216
    Sequence of events:
    DAQmx Create Task
    DAQmx Timing (finite samples, 1000Hz)
    Use DAQmx timing property SampQuantamples per channel to set buffer size
    Write buffer with DAQmx Write
    Repeat
      DAQmx Start Task
      DAQmx Wait until done
      DAQmx Stop Task
    Until finished
    DAQmx Clear Task
    I get a full waveform output on the first iteration of the loop. On subsequent iterations I get only a small section of the waveform, but no error. It seems that it is regenerating the waveform, because when I switch off regeneration I get an error at Start Task, but before it can regenerate all the data Wait Until Done.vi decides that the generation is done and exits, stopping the generation.
    I have done this with a PCI device and it works fine; every call to Start Task generates the whole waveform again.
    OK, so it looks like after every waveform generation completes I need to reset the pointer to the start of the buffer, so that the Wait Until Done vi does not think the generation is done. Or - maybe there is a way to reset the "Generation Done" state?
    I'm sure there's an easy way to do this....?

    Hi CDancer,
    Many thanks for contacting National Instruments. If I can start by giving some general advice, it would be well worth posting your actual VI. This helps others on this forum in helping you with your application. 
    From the sounds of things, you want to do continuous analog output generation. I have had a look at the examples that come with LabVIEW and I think you should look at the one below.
    I would have a look at some of the DAQmx examples that come installed with LabVIEW. The following example would be particularly relevant I feel
    Cont  Gen Voltage Wfm-Int Clk-non Regeneration.vi 
    Please let me know how you get on.
    Many thanks,
    Andrew McLennan
    Applications Engineer
    National Instruments

Maybe you are looking for

  • How can I save a Adobe document to print duplex for other users.

    I want to create a doc using Adobe and be able to set it to print duplex by other users without the user needed to go into printer settings. All the user has to do is click print on there computer and the doc. will print duplex. The users have Adobe

  • Problem in converting Spool Request into PDF format

    Hi,   I am facing problem to convert spool request (which store output of sap script) in to PDF format. Actually I have converted it with function module 'CONVERT_OTFSPOOLJOB_2_PDF' and it is working properly but the problem occurs where the BOLD fon

  • Regardin a Tv card to sound card connect

    Hi all I have an MSI SLI Platinum motherboard using the onboard SB Li've 24 bit. I have creatives p5800 5. speakers attached. but these speakers use the line out i think which is what a tv card needs to connect to also. am i right or am i wrong also

  • OWB 10.1.0.4.0 deployment results in RPE-01011

    We are deploying the same project, developed in OWB version 10.1.0.4.0, to both a test and production server. Since a reorganisation of those servers we've been unable to deploy mappings to the production site, due to an apparent version discrepancy:

  • OEM in 9i

    Hi friends, how can i access 9i's OEM from remote computer. Thanks