06-19-2007 08:32 AM
I am upgrading an application from VB6 to Dotnet 2.0.
In VB6 we had the ocx with the user interface where we could do the settings.
In .NET 2.0 I created the task in code :
private void CreateSoftAnalogTask()
{
try
{
softTask = new Task("WMSAnalogTask")
softTask.AIChannels.CreateVoltageChannel("Dev1/ai0:4",string.Empty,
AITerminalConfiguration.Rse, -10.0,+10.0, AIVoltageUnits.Volts)
softTask.Timing.ConfigureSampleClock("PFI7", 20000,
SampleClockActiveEdge.Falling,SampleQuantityMode.FiniteSamples)
softTask.Timing.SamplesPerChannel = 4000
softTask.Stream.ReadWaitMode = ReadWaitMode.Sleep
softTask.Stream.Timeout = -1
softTask.Control(TaskAction.Verify)
softReader = new AnalogMultiChannelReader(softTask.Stream)
softReader.SynchronizeCallbacks = true
softTaskCreated = true
}
catch (Exception ex)
{
log.Error("Error in CreateSoftAnalogTask", ex)
}
}
I start the task :
softReader.BeginReadMultiSample(Convert.ToInt32(4000), new AsyncCallback(softCallback), null)
This task is externally triggerd. due to PLC limitations I get the start signal a little bit ahead before I get the pulse train for the external triggering.
In the VB6 version I didn't get any errors, now I get often the following exception :
NationalInstruments.DAQmx.DaqException: Measurements: ADC conversion attempted before the prior conversion was complete.
Increase the period between ADC conversions. If you are using an external clock, check your signal for the presence of noise or glitches.
After conversation with the email support they gave me the following solution.
http://forums.ni.com/ni/board/message?board.id=250&message.id=14324&requireLogin=FalseI did then added to the configuration :
Task.Triggers.StartTrigger.ConfigureDigitalEdgeTrigger("PFI0",DigitalEdgeStartTriggerEdge.Rising);
I wired the PFI7 (where the extern trigger pulse is connected) to the PFI0 since I don't have another signal to start on.
I tried this but I still receive the -200019 error.
Please Help ....