LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

iviscope sample waveform size

Hi all,

 

I am trying to run the IviScope example (<documents..>\National Instruments\CVI\Samples\IVI\IviScope) and I am getting a runtime error about the waveform size:

 "FATAL RUN-TIME ERROR:   "iviscopu.c", line 193, col 64, thread id 0x00000FB4:   Array argument too small (80000 bytes).  Argument must contain at least 16000000 bytes (16000000 elements)."

which is on the following line:

"            plotHandle = PlotWaveform (readHandle, READ_GRAPH, waveformArray,
                                       actPoints, VAL_DOUBLE, 1.0, 0.0, initialX,
                                       XIncrement, VAL_THIN_LINE, VAL_EMPTY_SQUARE,
                                       VAL_SOLID, 1, VAL_YELLOW);
"

 

I am connecting to Lecroy scope Wavesurfer 454 using the class driver. I assume the connection is working fine, because the previous function calls work.

I do not understand if the example is indeed wrong or if the Lecroy's driver is misbehaving.

In the documentation of IviScope_ReadWaveform I can read:

"(1) The IviScope_ActualRecordLength function returns the number of points the oscilloscope acquires for each channel.  Pass a ViReal64 array with at least this many elements."

 

What does this mean? It means that if I pass a smaller array only a part of the waveform is returned or that I will have a memory buffer overflow?

I assume the first, so I tried to fix the code replacing "actPoints" with "min(actPoints, waveformSize)".

It works, but I would like a confirmation that this is correct: I am still puzzled that the distributed example does not run out of the box.

 

I am new to CVI and IVI drivers, I tried to look in the forum but did not find anything about this.

 

Thank you in advance.

0 Kudos
Message 1 of 7
(4,389 Views)

Hi,

I still haven't the chance to deeply troubleshoot the example (also because I miss the driver).

However, I think your guess is right, as you were able to make the example work correctly.

I'll post back as soon as I'll discover a more detailed explanation.

I'm glad you were able to fix the error!

Bye!

 

Licia

0 Kudos
Message 2 of 7
(4,366 Views)

Hello Aldo,

        This might be due to a problem in the IVI Specific Driver.  When the Class Driver Example calls:

 

checkErr(IviScope_ReadWaveform (instrumentHandle, channelName, waveformSize,
                                    maxTime, waveformArray, &actPoints, &initialX, &XIncrement));

 

It is just calling the IVI Specific Driver's ReadWaveform, which might be returning the incorrect number of actPoints.   Could you please tell me what value is being returned to actPoints?  You could also try making a simple example with the Specific Driver functions or see if the Specific Driver includes an example program.

 

Thank you,

 

NathanT

0 Kudos
Message 3 of 7
(4,360 Views)

Hi Nathan, Licia,

thanks for answering.

 

I cannot check right now as I am OOF till friday, but if I remember correctly actPoints contains a number 100 times bigger than waveformSize, like 1M against 10K, and this number is equal to what returned by ActualRecordLength + 2 (I don't know where the +2 comes from, either).

So it looks like actPoints contains the size of the waveform in the scope, not the one returned by ReadWaveform.

Is this the expected behaviour?

 

Aldo

0 Kudos
Message 4 of 7
(4,349 Views)

Hello Aldo,

         That certainly does not sound correct to have ActPoints be 100 times larger than WaveformSize.  When you are back in the office, please let us know what calling the Specific Driver ReadWaveform returns for ActPoints.

 

Thanks,

 

NathanT

0 Kudos
Message 5 of 7
(4,323 Views)

Hi Nathan,

sorry it took so long to answer.

I re-ran the original example, and the WaveforSize passed to IviScope_ReadWaveform is 10000, whereas actPoints is 1000002. I do not know how much this is related, but the IviScope_ConfigureAcquisitionRecord had been called requesting a minimum of 1000 points. With my modified version, IviScope_ActualRecordLength returns 1000000, then I allocate a proper-sized buffer and call IviScope_ReadWaveform with that. Also in this case the returned  actPoints is 1000002, so a +2 is added for some reason.

If I specify to simulate the scope with the specific driver in MAX, the actPoints is only 100, so I have no issues.

I cannot test using only the specific driver now, if needed I will try next week.

 

Thanks

 Aldo

0 Kudos
Message 6 of 7
(4,271 Views)

Hello Aldo,

          Thanks for the additional information.  I will look forward to seeing your results from testing with the specific driver directly.  I think that the problem is in the specific driver, and recommend informing LeCroy, so that they can troubleshoot on their end.

 

Thanks,

 

NathanT

0 Kudos
Message 7 of 7
(4,225 Views)