Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

cDAQ9172 Pause Trigger

I am using cDAQ-9172 with NI 9263 and NI 9215 for my hardware and MSVC++8.1 for my software.

 

Plan:

1.  ao0 pin is connected to ai0 pin

2.  ao0 will output a certain voltage to ai0.

       .......

 

      

m_writer = std::auto_ptr<CNiDAQmxAnalogMultiChannelWriter>(new CNiDAQmxAnalogMultiChannelWriter(m_taskAO->Stream));

   .......   

    m_writer->WriteMultiSample(true, *pData);

    m_taskAO->Start();

    m_taskAI->Start();

    .......

    m_reader = std::auto_ptr<CNiDAQmxAnalogMultiChannelReader>(new CNiDAQmxAnalogMultiChannelReader(m_taskAI->Stream));

    m_reader->InstallEventHandler(*this, &CContAcqVoltageSmps_IntClk_PauseTriggerDlg::OnEvent);

    m_reader->ReadMultiSampleAsync(m_numberOfSamples, m_data, NULL);

 

 

 

3.  Then the AI module will send a pause trigger to AO (Trigger source:  /cDAQ1/ai/PauseTrigger)

m_taskAO->Triggers.PauseTrigger.ConfigureDigitalLevelTrigger(triggerSource, m_gateLevel);

...... 

m_writer->WriteMultiSample(false, *pData);

 

m_taskAO->Start();

Questions:

1.  Item #2 is running but my problem starts at #3. 

2.  Does the program implementation makes sense?  I am not sure specially about item #3.

3.  If I run item #3, I encounter an error saying that the specified property cannot be set while task is running.

     How can I continue without stopping the output task in #2.

4.  Is it possible to have two output waveforms?  One is the voltage sourcing of AO and 2nd is the pause trigger

     for AO task.  

 

Thank you and please advise.

A  

0 Kudos
Message 1 of 9
(4,258 Views)
Hi Angel,
 
The error message you are receiving is because you start an analog output task entitled m_taskAO in step two and then in step three, for that task, you try to configure it to accept pause triggers and restart it. Tasks need to be completely configured, including whether or not to accept triggers, before they are begun. After a task is started, you cannot change its settings.
 
As to your last question, yes, it is possible to have multiple waveforms (one per channel) in a single analog output task. You will need to configure a new analog output task for each module capable of analog output.
 
However, I am a  bit unclear as to your application. Do you simply want to pause the analog generation based on a signal from the analog input module? If so, you do not need an analog output task to output the trigger.
 
Hope this helps,
Mallori M.
Mallori M
National Instruments
Sr Group Manager, Education Services

ni.com/training
Message 2 of 9
(4,238 Views)

Hello Mallori,

Thanks for the enlightenment.  Right now, I am rearranging my lines and figuring out how to manage the start or stop of tasks.

For my application, its true that I want to pause the analog generation based based from the analog input module.  But in my case, I have two analog channels.  The 1st  is the analog channel that sourced a voltage to an analog input module.  2nd is the analog channel that was paused triggered by an analog input module.   

Best regards,

Angel

 

 

 

 

 

 

0 Kudos
Message 3 of 9
(4,233 Views)

Hi Angel,

I apologize, but I am afraid I am still confused. So you are outputting on two channels of your 9263. The first analog output channel is wired to your analog input module. The second analog output channel is outputting another waveform, which you would like to programmatically start and stop? If you could perhaps attach a drawing that might help clear things up.

To help with a discussion oif what type of triggering you want you can look at this document, which includes explanations of the types of triggers. While the program is Traditional DAQ, the illustrations of signals are still helpful.

Regards, Mallori M.

Mallori M
National Instruments
Sr Group Manager, Education Services

ni.com/training
Message 4 of 9
(4,215 Views)

Hello Mallori,

Sorry for the late reply.  I am attaching an illustration of what my program should do.  By the way, our order for the NI 9401 module recently arrived.  I used the PFI as trigger source in the original pause trigger program and also tried other trigger examples.  I was able to execute it.  It was easy and convenient.  Nevertheless, I want to explore using non-pfi signals as trigger source.

Using the same concept based from the attachment, I rewrote the program to cater two NI 9263 modules but my program ended up with the status error: -89137.  I also tried another strategy wherein I have one output task and created two voltage channels.  Nevertheless my status error is -89137.   Smiley Sad   

 

Best regards,

Angel

 

Download All
0 Kudos
Message 5 of 9
(4,178 Views)

Hi Angel,

I guess a better question to ask is for an idea of your end goal, what you are trying to do, or your complete application. The diagram was helpful but I am still unclear as to trigger direction and trigger routing from that diagram.

Whne you say ai/Pause Trigger, that pauses the analog input. If you want to pause the analog output you will need to use the ao/Pause Trigger and define a source. You can look at pages 24-26 of the cDAQ-9172 User Guide for a great explanation with images of Analog Out Pause Triggering. Elsewhere in the guide it discusses Analog Input Pause triggering.

After reading this guide, you can post back with what conditions you want to pause with.

Hope this helps, Mallori M.

Mallori M
National Instruments
Sr Group Manager, Education Services

ni.com/training
0 Kudos
Message 6 of 9
(4,134 Views)
Hello Mallori,
 
Sorry for the confusion.  I modified the same diagram and I hope I am able to convey my message.
 
Overview:  Continuous voltage generation of an output channel then the an input channel will pause this generation.  Instead of using a power supply as a voltage source to the input channel, I used another output channel to supply this voltage.  So I have two output channels and an input channel to achieve this objective.   
 
Details:
1.  Voltage generation of AO0 & AO1.
 
1.  AI0 will capture/ acquire the voltage from AO0. AO0 is physically wired to AI0.
 
2.  Once I press the START button in my UI, AI0 while will pause the voltage generation AO1. 
 
Regards,
A
0 Kudos
Message 7 of 9
(4,121 Views)

Hi Angel,

So, as I understand it, you are outputting two voltages to a scope. You want to stop and start your second voltage (AO1) based off of your first output voltage (AO0).  To do so, you are using the analog input module to monitor AO0.

1.    Is AO0 a constant voltage or is it varying?

2.    Do you want to stop and start just AO1, or both AO0 and AO1?

3.    Do you just want to stop the generation, or start the generation, or both stop and then start the generation?

4.    What conditions do you want to stop and start AO1 under? For instance, when AO0 reaches a certain point, do you want to stop outputting on AO1? And then when AO0 drops below that point, do you want to start outputting once again? If this is the case, this is Hardware Analog Pause Triggering. You are monitoring an analog signal to determine when to start and stop some action, typically using what is called a window to define the voltage limits.

5.    In your post you mentioned a START button. Is this a physical button on hardware that you push with your finger? Or is this a software button on your program’s user interface that you click with a mouse?

6.    Are you displaying the analog input on a graph and watching it to see when to press this START button? What relation does the analog input have to the START button?

7.    Do you want the START button stop the analog output of AO1 when pressed down, and start the generation again when the button is released? Or when it is pressed again?

 

I think that the answers to these questions will get us on the same page.

Regards, Mallori M.

 

Mallori M
National Instruments
Sr Group Manager, Education Services

ni.com/training
0 Kudos
Message 8 of 9
(4,096 Views)
Hello Mallori,
 
Thanks for being patient with me.  Robot Happy
 
1.    Is AO0 a constant voltage or is it varying?
     DC voltage but i have a function to convert to a square wave .
2.    Do you want to stop and start just AO1, or both AO0 and AO1?
     AO1.
3,  Do you just want to stop the generation, or start the generation, or both stop and then start the generation?
     stop generation.  Is it possible to stop AO1 only?  If yes is there an API for this?
4.  What conditions do you want to stop and start AO1 under? For instance, when AO0 reaches a certain point, do you want to stop outputting on AO1? And then when    AO0 drops below that point, do you want to start outputting once again? If this is the case, this is Hardware Analog Pause Triggering. You are monitoring an analog signal to determine when to start and stop some action, typically using what is called a window to define the voltage limits.
     Is it possible to achieve via digital triggering?  I do not have a module that supports hardware analog triggering. 
5.  In your post you mentioned a START button. Is this a physical button on hardware that you push with your finger? Or is this a software button on your program’s user interface that you click with a mouse?
     a mouse click on the UI button
6.  Are you displaying the analog input on a graph and watching it to see when to press this START button? What relation does the analog input have to the START button?
    Yes, I have an analog input on a graph.  My purpose is to monitor my output.  But for now, the input has nothing to do with the start button.  
 
Thanks and best regards,
Angel
 
0 Kudos
Message 9 of 9
(4,078 Views)