From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Run time error when calling Start() method from an Output counter user control in my class.

I am new to DAQmx and .NET.
In my application I need to activate a clock out on counter 2 (HW pci 16 E 4).
I went through all the steps like the sampling examples but instead of Analog input
I used counter output , and setup the pulse ratios.

When I click the switch in the user interface ( a user control databinded to the clock output)
the output works. Since I need to activate it programmatically I tried to call the daQmxUserControl11.Start()
method but this causes the following error :


An unhandled exception of type 'NationalInstruments.DAQmx.DaqException' occurred in nationalinstruments.daqmx.dll
Additional information: Specified operation cannot be performed while the task is running.
Task Name: DAQmxTask1
Status Code: -200479


Any ideas on what am I doing wrong?

Thanks David
0 Kudos
Message 1 of 4
(2,608 Views)
Hello Dave,

You are probably getting that error because you are starting the task twice, and this cannot be done. You can actually find examples that does exactly what you want in the following folder:

...\Program Files\National Instruments\MeasurementStudioVS2003\DotNET\Examples\DAQmx\Counter\Generate Pulse

hope this helps,

LA
0 Kudos
Message 2 of 4
(2,599 Views)
Thanks a lot,
I also discovered that dragging the user control onto my user interface doesn't allow alternate activation.
( I actually tried stopping and then starting but the result was the same )

Calling the routines as indicated in the header comments also gave some hiccups ( I had to remark some code to get the system working progrtammatically.

public void Start()
{
#region Update UI
/*
this.switch1.Caption = "On";
this.switch1.Value = true;
*/
#endregion

daqmxTask.Start();
}

public void Stop()
{
#region Update UI
/*
this.switch1.Caption = "Off";
this.switch1.Value = false;
*/
#endregion

daqmxTask.Stop();
}

#region Methods
0 Kudos
Message 3 of 4
(2,591 Views)
No problem...it is my pleasure to help you.

Feel free to post more threads if you have any more questions.

Regards,

LA
0 Kudos
Message 4 of 4
(2,581 Views)