12-03-2007 01:22 AM
12-03-2007 11:00 AM
12-03-2007 11:00 AM
12-03-2007 11:00 AM
12-03-2007 11:00 AM - edited 12-03-2007 11:03 AM
12-04-2007 12:28 AM
12-04-2007 11:23 AM
10-05-2011 01:01 PM
Hi,
I am having a problem with speed of the strip chart. The GAIN is 1.0, absolute time, strip chart is refreshed in TIMER function, but I cannot get real time situation. The time is runing much more faster then it should. Can anyone help me?
int CVICALLBACK set (int panel, int control, int event,void *callbackData, int eventData1, int eventData2){
double curtime;
switch (event){
case EVENT_COMMIT:
GetCurrentDateTime (&curtime);
SetCtrlAttribute (panelHandle, PANEL_STRIPCHART, ATTR_XAXIS_OFFSET,curtime);
SetCtrlAttribute (panelHandle, PANEL_STRIPCHART, ATTR_XAXIS_GAIN, 1.0);
SetCtrlAttribute (panelHandle, PANEL_STRIPCHART, ATTR_XPRECISION, 2);
SetAxisTimeFormat (panelHandle, PANEL_STRIPCHART, VAL_BOTTOM_XAXIS, VAL_ABSOLUTE_TIME_FORMAT, "%H:%M:%S:%2f");
go=1;
break;
}
return 0;
}
int CVICALLBACK timerica (int panel, int control, int event,void *callbackData, int eventData1, int eventData2)
{
switch (event){
case EVENT_TIMER_TICK:
if(go){
PlotStripChartPoint (panelHandle, PANEL_STRIPCHART, 1.00);
}
break;
}
return 0;
}
10-06-2011 12:07 PM
Hi mitros,
I think you might be misunderstanding the purpose of the time axis in the chart. It's not intended to control your plotting speed. It is merely an indicator of a timestamp associated with each data point.
When you use a gain of 1.0, you are telling the chart that each data point that you plot to the strip chart was acquired 1 second after the previous data point. This doesn't mean that the strip chart will wait 1 second before plotting the next point. A strip chart is not a real-time control! It merely gives you a way to visualize data that might or might not have been acquired in real-time.
In your case, the plotting speed is determined primarily by the interval at which your timer control fires the EVENT_TIMER_TICK event. You have it set to 0.05 seconds, which means you're plotting a point every 0.05 seconds. Therefore, you should either change the gain of the chart's x-axis from 1.0 to 0.05, or you should change the timer interval from 0.05 to 1.0. If you do that, the axis and the data will be in sync.
Luis
10-07-2011 12:37 AM
Luis,
Thanks for reply.
The situation is like this: I have to acquire digital signals with NI USB 6501, store that values in file and plotting them in realtime. What is the best way to do that (plotting)? When I use PlotStripChart, with timer tick 0.02s, I set the gain for example 0.02/24, and 1000 points per screen and even then there is a slight difference in actual time respect to strip chart time, end that difference progresses with time.
Thank you in advance,
Igor