Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Arming Analog Input and Immediate Trigger

Solved!
Go to solution

Hello,

 

I have seen that if I arm the analog input (so that it is ready to acquire data when it receives a trigger) and then immediately send a trigger, the analog callback does not fire.  If there is some delay (500ms) before sending the trigger, the callback behaves as expected.

 

Has anyone seen this behaviour before?

 

I've attached example code.  It is C# written in Visual Studio 2015.  I've tried this for both a PCIe-6351 and a USB-6351 cards.  The card is named "Daq1" in MAX.  There is a wire connecting Port0/Line0 to PFI0 for the trigger.  I have DAQmx driver 15.1.1 installed.

 

The example code has 4 buttons - "Arm AI", "Send Trigger", "Both", and "D". 

 

"Arm AI" prepares the analog input.  The button is disabled until it receives a trigger.

 

"Send Trigger" sends the trigger.  If I click "Arm AI" then click "Send Trigger", it works as expected. 

 

"Both" calls the code for arming the AI then immediately sends the trigger.  If I monitor with a multimeter, I can see that the trigger is sent properly when "Both" is pressed.  However, the callback (which re-enables the "Arm AI" button) does not get called.  I know that the analog input is waiting for a trigger (if I click on "Send Trigger", it'll behave as expected.  Instead, if I click on "Arm AI" again, I get an error message about conflicting task, as expected).

 

"D" calls the code for arming the AI, waits a delay of 500ms and then sends the trigger.  This works as expected.

 

Thanks,

David

0 Kudos
Message 1 of 7
(3,225 Views)

Hello David,

 

Is 500 ms the minimum delay that is necessary for expected callback behavior? I would expect a small delay necessary to arm the input as part of the setup time, but it should be significantly quicker than half a second.

 

Eric Wang

Applications Engineering

0 Kudos
Message 2 of 7
(3,186 Views)

Hello Eric,

 

Thanks for the response.

 

I've used the same posted example and dropped the delay from 500ms to about 112ms.  This appears to be the threshold.  Do you know if there is any way to determine when the setup is completed?  Is there an event that gets fired?  Added an arbitrary delay does seem like a good practice.

 

Thanks,

David

0 Kudos
Message 3 of 7
(3,179 Views)

With both devices?

 

That is still way more than I would expect any kind of delay to be.

 

Eric

Applications Engineering

0 Kudos
Message 4 of 7
(3,162 Views)

Hello Eric,

 

I've run the test again.  On the PCIe-6351, the threshold is now 98ms.  On the USB-6351, the threshold is now 109ms.

 

Thanks,

David

0 Kudos
Message 5 of 7
(3,144 Views)
Solution
Accepted by topic author davidnmicrosys

 I do not believe there is any specification for this. Can I ask why you are doing this? 

 

You could also pre-arm this trigger or just take out the arming completely and start the AI on the start command.

 

Eric

Applications Engineering

0 Kudos
Message 6 of 7
(3,131 Views)

Hello Eric,

 

Thanks for the response.  The code belongs to a larger piece of test software.  When connected to actual devices in the field, the analog input is armed, the trigger is sent immediately and after some delay (due to physical limitations) the trigger is routed back to PFI0.  In the office, the trigger is wired directly to PFI0 (and therefore does not have the additional delay).

 

I contacted NI Support.  It is working as expected.  There does not appear to be any specification on how long to wait before the analog input is successfully armed, nor is there any feedback.  The suggested solution from NI in this scenario is to start acquisition immediately instead of arming and then immediately triggering.

 

Thanks,

David

 

 

0 Kudos
Message 7 of 7
(3,116 Views)