Hello world, after some year I use CVI, what is happening to me is
truly incredible. I have put here a function recalled from my
main program through a timer that it ticks every tenth of second: its scope
is that one to acquire data in an array in order to
mediate them (draft in reality of pseudo code in order not to weight
down the reading).
int CVICALLBACK TimerGlobale (int panel, int control,
int event, void *callbackData, int eventData1, int eventData2)
{
int i;
switch (event)
{
case EVENT_TIMER_TICK:
if (++counter_array >=
DIMENSION_ARRAYI) counter_array = 0;
for (i=CH_TEMPERATURE_1;
i<=LAST_CHANNEL; i++)
{
VReadChannel (card_num, i,
&data [i] [counter_array]);
data [i]
[counter_array] = parameter [2*i] *CALCULATE_TEMPERATURE
(data [i] [counter_array]) +parameter [2*i+1];
Mean
(data [i], DIMENSION_ARRAY, &mean [i]);
}
break;
}
return 0;
}
I have put in boldface the indicted line. The
variable Array parameter contains the parameters of the line of calibration of several channels, while macro CALCULATE_TEMPERATURE only serves in order to transform the volt from the
acquisition function in effective the centigrade degrees. I have tried
to put in the watch window the entire expression and the single data of the
operation and obtain paradoxical situations of the type:
parameter [2*i] = 1.042
CALCULATE_TEMPERATURE (data [i]
[counter_array]) = 10.6
parameter [2*i+1] = -3.019
data
[i] [counter] = 9.11
while the result of the operation is
approximately 8.02!!!!
The thing still more amazing is that this
anomaly is only introduced for i=0…. Someone knows to help me?
Thanks
Regards
Andrea