Tektronix Technical Forums are maintained by community involvement. Feel free to post questions or respond to questions by other members. Should you require a time-sensitive answer, please contact your local Tektronix support center here.

How to clear output queue

Post Reply
Posts: 10
Joined: July 30th, 2018, 12:46 am
Country: Denmark

How to clear output queue

Post by mlaursen » November 4th, 2019, 3:47 am


I am running TSP scripts on 4 2602B instruments with TSP link. I call the scripts from a VBA macro. In the scripts I make measurements with overlappediv command


I then print the measurements with

printbuffer(1, MaxIterations, smu3.nvbuffer2) --V3
printbuffer(1, MaxIterations, smu3.nvbuffer1) --I3
printbuffer(1, MaxIterations, smu2.nvbuffer2) --V2
printbuffer(1, MaxIterations, smu2.nvbuffer1) --I2
printbuffer(1, MaxIterations, smu4.nvbuffer2) --V4
printbuffer(1, MaxIterations, smu4.nvbuffer1) --I4

To get the measurements into VBA I run a ReadNumber command.

For i = 0 To 4
instrout(i) = instrAny.ReadNumber()
Next i

However, when doing this, the data queue is not cleared. So when I run a second measurement, the first measurement is still in the beginning of the instrout array.

In the TSP scripts there are both smuX.reset and smuX.nvbufferY.clear() in the very beginning of the script.

Andrea C
Keithley Applications
Keithley Applications
Posts: 1548
Joined: October 15th, 2010, 10:35 am
Country: United States

Re: How to clear output queue

Post by Andrea C » November 7th, 2019, 3:56 am

sounds like ReadNumber() is a function you have written? How does it relate to the data in the smuX.nvbufferX?

After you clear the buffer, see if it indeed has cleared. Interrogate the value of smuX.nvbufferX.n

Code: Select all

numberOfReadings = smua.nvbuffer1.n
A typical buffer reset function is below. Call it for each of your SMU, e.g., reset_buffers(node[1].smua)

Code: Select all

function reset_buffers(smu)
    	-- Prepare the Reading Buffers
	smu.nvbuffer1.appendmode		= 1
	smu.nvbuffer1.collecttimestamps	= 1
	smu.nvbuffer2.appendmode		= 1
	smu.nvbuffer2.collecttimestamps	= 1

end  -- function

Posts: 10
Joined: July 30th, 2018, 12:46 am
Country: Denmark

Re: How to clear output queue

Post by mlaursen » November 7th, 2019, 5:32 am

Hi Andrea,

It is a command from a visa communication library

Set instrAny = New VisaComLib.FormattedIO488


The first thing I do in the functions is to clear the buffer.


However, I found a solution with the instrAny.IO.clear in the VBA macro. That appears to fix the problem.

Post Reply

Return to “Resistivity Measurements”

Who is online

Users browsing this forum: No registered users and 2 guests