04-25-2013 08:01 PM - edited 04-25-2013 08:01 PM
HI,
We are using NI PXI 4071 DMM in .NET (C#) and see a strange behavior of the instrument set for multipoint acquisition with software trigger.
We are trying to acquire multiple series (let's say 5), where each set having 4 samples,
Our settings are
TriggerSource = nidmmConstants.SoftwareTrig;
SampleTrigger= nidmmConstants.SoftwareTrig;
and we sending calls SendSoftwareTrigger() for each sample;
1. We see that acquisition of the first sample in each series is not waiting for the SendSoftwareTrigger() call but done immediately!
Total number of the SendSoftwareTrigger() calls required for the data acquisition is not 20 but 15!
2. How we can setup start of acquisition of the each set by software trigger, but acquisition of the each sample in the series immediately with time interval?
So, for 5 series we will send only 5 SW triggers, where each one should start acquisition of 4 samples one after another till next set?
Expected combination of the
TriggerSource = nidmmConstants.SoftwareTrig;
SampleTrigger= nidmmConstants.Immediate;
does not work. We have seen immediate acquisition of the all 20 samples!
04-27-2013 05:38 PM
Hi gremlm,
Can you share a bit more of your code to help us understand how you configure and start your acquisition tasks? Am I correct in understanding that you'd like to acquire 4 samples from the same line immediately after a software trigger, wait some time, then acquire another 4 samples after another trigger, and so on?
Have you taken a look at any of the text-based examples provided with the DAQmx drivers? I realize you are using NI-DMM, but the triggering should be similar.
04-29-2013 12:55 AM - edited 04-29-2013 12:56 AM
Our problem is that even when we set up TriggerSource to software trigger, data aquisition happened immeditedly
By the way we are familiar with DAQmx very well, there are no such problems there.
I think that there is an error in NI 4071 DMM driver.
Because if we set the TriggerSource first to External trigger and than to the Software, everything works exactly as we expecting!
Transition of the TriggerSource from Immedite to Software trigger directly does not work!
Transition of the TriggerSource from Immedite External than to Software trigger works!
We have tried to use a digital line for triggereing (we have a PXI system and used PXI trigger line #5).
Exactly the same problem was detected:
Transition of the TriggerSource from Immedite to TTL5 trigger directly does not work!
Transition of the TriggerSource from Immedite External than to TTL5 trigger works!
Another confusing issue:
We TriggerSource to Software trigger and reset device through the Reset command
Than we check the the value of the TriggerSource.
It is not restored back to Immedite, but is equal to the Software trigger!
There is a definetly an error in NI 4071 DMM driver!
04-29-2013 05:36 PM
Hey Gremlm,
What happens if you change the trigger from Immediate to TTL5, then to TTL5 again?
Can you post the relevant section of your code, or let us know which example you're using?
...
Which reset command are you calling? (niDMM Reset or niDMM Reset with Defaults)
04-29-2013 06:17 PM - edited 04-29-2013 06:17 PM
>>What happens if you change the trigger from Immediate to TTL5, then to TTL5 again...
What is a point to set up trigger to TTL5 multiple times? It doesn't work from the first one?
If we sets TriggerSource to External than to any other - it always works!
Question is why it doesn't work directly!
For reset we has
niDriver.reset();
Should we execute
niDriver.ResetWithDefaults() instead?
04-30-2013 04:02 PM
Hi gremlm,
Is it possible for you to post some code that shows the issues you are having? So far I have tried replicating the incorrect triggering behavior that you're describing without success. Being able to work with your code would be helpful. Are you using niDMM Read or niDMM Fetch to return your samples?
What version of NI-DMM are you using? What values are you using for Trigger Count and Sample Count? If you are taking 5 sets of 4 measurements, your trigger count should be 5 and your sample count should be 4. These are the values that I used.
When I set TriggerSource to SoftwareTrig and SampleTrigger to SoftwareTrig, no samples are returned until I send a software trigger. Using this configuration, one sample is returned for every software trigger I assert.
When I set TriggerSource to SoftwareTrig and SampleTrigger to Immediate, no samples are returned until I send a software trigger. Using this configuration, 4 samples are returned for every software trigger I assert.
I was able to reproduce the behavior you described regarding niDMM Reset. TriggerSource is not reset to its default value when Reset is called. You should explicitly set the TriggerSource at the begininng of your code to get around this issue.
Let me know the answers to these questions and we can continue troubleshooting.
04-30-2013 04:36 PM
Hey GremIm,
>>What is a point to set up trigger to TTL5 multiple times?
My recommendation was to determine if there was a user-related programming issue. We still don't know if you're using NI's example code, or your own custom configuration. If you're able to reproduce the issue with NI-published examples, that will help us hone in on the answer. If you're using your own code, post the relevant section here and we can see if there's incorrect API usage. I agree that the code should be capable of working directly, without the intermediate call to external trigger, but we first need to reproduce the behavior you're seeing here, so we can see where the issue resides.
Have a great day!
04-30-2013 06:32 PM - edited 04-30-2013 07:01 PM
Do you have an example where Software trigger is used for 4071 DMM multipoint data acquisition under .NET so we can try it?
About our code - it is a rather a big application, but here is simplified version what we are doing (C# code:)
EXAMPLE1
// Setting measurement function DCVoltage, range, presicion, aperture, etc.
niDriver.SetInt32(nidmmProperties.TriggerCount, 1);
niDriver.SetInt32(nidmmProperties.SampleCount, 10);
nidmmConstants.External
niDriver.SetInt32(nidmmProperties.TriggerSource, nidmmConstants.SoftwareTrig);
niDriver.SetInt32(nidmmProperties.SampleTrigger, nidmmConstants.SoftwareTrig);
niDriver.Initiate();
//Commented:
// for(int i=0; i< 10; i++)
//{
// niDriver.SendSoftwareTrigger();
// Thread.Sleep(200);
//}
Double[] result = new Double[10];
int numberOfPoints = 0;
niDriver.FetchMultiPoint( 1000, 10, result, out numberOfPoints);
and data is aquired without sending software triggers!
but
EXAMPLE1.1
// Setting measurement function DCVoltage, range, presicion, aperture, etc.
niDriver.SetInt32(nidmmProperties.TriggerCount, 1);
niDriver.SetInt32(nidmmProperties.SampleCount, 10);
niDriver.SetInt32(nidmmProperties.TriggerSource, nidmmConstants.External);
niDriver.SetInt32(nidmmProperties.TriggerSource, nidmmConstants.SoftwareTrig);
niDriver.SetInt32(nidmmProperties.SampleTrigger, nidmmConstants.SoftwareTrig);
niDriver.Initiate();
//Commented loop:
// for(int i=0; i< 10; i++)
//{
// niDriver.SendSoftwareTrigger();
// Thread.Sleep(200);
//}
Double[] result = new Double[10];
int numberOfPoints = 0;
niDriver.FetchMultiPoint( 10000, 10, result, out numberOfPoints);
data not aquired without sending software triggers!
It only works if "Commented loop:...." code is un commented!
The same is true for the following code:
EXAMPLE2
// Setting measurement function DCVoltage, range, presicion, aperture, etc.
niDriver.SetInt32(nidmmProperties.TriggerCount, 1);
niDriver.SetInt32(nidmmProperties.SampleCount, 10);
niDriver.SetInt32(nidmmProperties.TriggerSource, nidmmConstants.SoftwareTrig);
niDriver.SetInt32(nidmmProperties.SampleTrigger, nidmmConstants.Immediate);
niDriver.Initiate();
// niDriver.SendSoftwareTrigger();
Double[] result = new Double[10];
int numberOfPoints = 0;
niDriver.FetchMultiPoint( 10000, 10, result, out numberOfPoints);
and data is aquired without sending software trigger for entire set!
but
EXAMPLE2.1
// Setting measurement function DCVoltage, range, presicion, aperture, etc.
niDriver.SetInt32(nidmmProperties.TriggerCount, 1);
niDriver.SetInt32(nidmmProperties.SampleCount, 10);
niDriver.SetInt32(nidmmProperties.TriggerSource, nidmmConstants.External);
niDriver.SetInt32(nidmmProperties.TriggerSource, nidmmConstants.SoftwareTrig);
niDriver.SetInt32(nidmmProperties.SampleTrigger, nidmmConstants.Immediate);
niDriver.Initiate();
// niDriver.SendSoftwareTrigger();
Double[] result = new Double[10];
int numberOfPoints = 0;
niDriver.FetchMultiPoint( 10000, 10, result, out numberOfPoints);
and data is not aquired without sending software trigger.
It only is acquired if
niDriver.SendSoftwareTrigger();
is uncommented!
04-30-2013 07:06 PM
The NI DMM version is 3.0.4
05-09-2013 10:59 AM
Hi gremlm,
Sorry for the delayed response. I set up a test machine and ran the code you provided. I wasn't able to replicate any of the problems you described.
When I ran Example 1 and Example 1.1, I do not recieve data unless the for loop is uncommented. If the for loop is commented out, I receive a timeout error, as expected.
When I ran Example 2 and 2.1, I get a timeout error unless I uncomment the software trigger you sent, in which case all 10 samples are returned.
I am not sure why your system seems to be generating false software triggers. You mentioned that is a big application. Is is possible that software triggers are being sent from elsewhere in your code?
The program that I was running is below:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NationalInstruments.ModularInstruments.Interop;
namespace DMM
{
class Program
{
static void Main(string[] args)
{
nidmm niDriver;
niDriver = new nidmm("PXI1Slot8", false, false);
niDriver.SetInt32(nidmmProperties.TriggerCount, 1);
niDriver.SetInt32(nidmmProperties.SampleCount, 10);
niDriver.SetInt32(nidmmProperties.TriggerSource, nidmmConstants.SoftwareTrig);
niDriver.SetInt32(nidmmProperties.SampleTrigger, nidmmConstants.SoftwareTrig);
niDriver.Initiate();
//for (int i = 0; i < 10; i++)
//{
// niDriver.SendSoftwareTrigger();
// System.Threading.Thread.Sleep(200);
//}
Double[] result = new Double[10];
int numberOfPoints = 0;
niDriver.FetchMultiPoint(1000, 10, result, out numberOfPoints);
var builder = new StringBuilder();
Array.ForEach(result, x => builder.Append(x + "\n"));
var res = builder.ToString(); //builds string from DMM results
Console.WriteLine(res + "\n" + "Number of Points: " + numberOfPoints); //Prints data to command line window
System.Console.Read(); //Waits for user input
niDriver.Abort();
}
}
}