02-09-2009 11:46 AM
Hello,
I am using c#, daqmx 8.6 and Ni-usb 6259.
I'm trying to plot some data which is working also correctly. The data will be acquired several times (in a loop) and plotted directly in a scattergraph.
When I am using the next code no error appears.
try{
if (_plotXWave != null && _plotResult_trigger != null)
{
if (_plotXWave.Length > 0)
{
this.scatterPlotTrigger.HistoryCapacity = _plotXWave.Length;
}
if (_plotXWave != null && _plotResult_trigger != null &&
_plotXWave.Length == _plotResult_trigger.Length)
{
this.scatterPlotTrigger.PlotXY(_plotXWave, _plotResult_trigger);
this.scatterGraph2.Refresh();
}
}
}
catch(Exception e){
Console.WriteLine (e.Message);
}
But sometimes appears an error which will be catched in the main method (I don't know why there and not here in the above code).
-----------------------
Message: Die Auflistung wurde geändert. Der Enumerationsvorgang kann möglicherweise nicht ausgeführt werden.
Source: mscorlib
StackTrace: bei System.Collections.Hashtable.HashtableEnumerator.MoveNext()
bei NationalInstruments.UI.Internal.c8.a(ComponentDrawArgsInternal A_0, RectangleF[] A_1)
bei NationalInstruments.UI.Internal.c8.b(ComponentDrawArgsInternal A_0)
bei NationalInstruments.Restricted.ControlElement.a(ComponentDrawArgsInternal A_0, Rectangle A_1, Boolean A_2)
bei NationalInstruments.Restricted.ControlElement.DrawChildren(ComponentDrawArgsInternal args, Rectangle clipRectangle)
bei NationalInstruments.Restricted.ControlElement.a(ComponentDrawArgsInternal A_0, Rectangle A_1, Boolean A_2)
bei NationalInstruments.Restricted.ControlElement.DrawChildren(ComponentDrawArgsInternal args, Rectangle clipRectangle)
bei NationalInstruments.Restricted.ControlElement.a(ComponentDrawArgsInternal A_0, Rectangle A_1, Boolean A_2)
bei NationalInstruments.Restricted.ControlElement.a(ComponentDrawArgsInternal A_0, Rectangle A_1)
bei NationalInstruments.Restricted.ControlElement.Paint(PaintEventArgs e)
bei NationalInstruments.UI.WindowsForms.ControlBase.OnPaint(PaintEventArgs e)
bei System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs)
bei System.Windows.Forms.Control.WmPaint(Message& m)
bei System.Windows.Forms.Control.WndProc(Message& m)
bei System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
bei System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
bei System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
-----------------------
In the attachment you can see the error which appears in the application. The measurement runs further, but the graph is only diplaying the big error picture.
Do you know how to solve it?
Do you know how I can redraw the scattergraph during the running measurement, so that I don't need to restart the application? A simple Refresh() or Update() call of the scattergraph has no effect.
Thanks in advance.
Best regards
02-12-2009 04:21 AM
02-12-2009 06:32 AM
I am using Measurement Studio 8.0.1.334.
NationalInstrument Windows Forms Control 8.0.20.334
I already posted a short part of my code. I assume that there is the problem, because the problem appears sometimes during updating the graph data.
In the software are 2 threads implemented:
First thread for the windows forms and the second for acquiring the measurement data.
Steps:
Thread 1: acquiring data
Thread 2 : plotting data
Thread 1: acquiring data
......
The error does not appear always. Maybe after every second run with the same measurement parameters. Therefore I don't understand what is the problem. I have also everywhere try catches which should catch the error, but the message appears always in the next block.
private static void UnhandledExceptionCatcher(object sender, System.Threading.ThreadExceptionEventArgs e)
{
Console.WriteLine(e.Message);
....
}
Do you know if there is a parameter set, which shows when the error picture is shown in the scattergraph?
And how I can reactivate the scattergraph so that I see again the normal situation with the x and y axis?
Thanks.
02-12-2009 06:40 AM
Directly after plotting the data I am automatically zooming in, because I don't need to see all data.
Only the first 2000 points.
this.scatterGraph.XAxes[0].Range = new NationalInstruments.UI.Range(0.0, 2000.0);