Posted Mon, 11 Mar 2024 17:24:26 GMT by Bidinger, Don
I created a script that works in Test Script Builder and am simply moving the script to python.  I seem to be stuck on how to pass the long array using the keithley.write() statements.  Things work if I shorten the array, but if i send the full array in I get an error input buffer overrun -363.

My code is relatively simple:

myList = {-.650, -6.30, -.670, -.625, -.665, .........-.170}  has 205 data points
smua.trigger.source.listv(myList)

I have tried to break up the data in multiple write statements, i have tried sending it in one statement, but i seem to missing something.  Is there a continuation character needed when breaking up the array?
keithley.write('myList = {-0.625, -0.580, -0.620, -0.575,.....-0.580, ')
keithley.write('-0.535, -0.575, -0.530, -0.570,..... -0.490,')
.
.
.



 
Posted Mon, 11 Mar 2024 18:46:28 GMT by Bidinger, Don
I am using 2602b
Posted Mon, 25 Mar 2024 16:04:32 GMT by C, Andrea
The input buffer is ~2000 characters.  Strings larger than that in a single VISA write will cause the -363, Input Buffer Overun Error.

Ideally, myList could be computed/generated in the TSP Lua runtime within the 2600B scripting engine.
But if not possible for your use case, here is one way that a long array in Python can be populated into a table in the TSP side of things.

 
# in Python, build an array of values
record_length = 360   # how many datapoints to generate
cycles = 3 # how many sine cycles
length = np.pi * 2 * cycles
vector = np.sin(np.arange(0, length, length / record_length))

#send commannds to
# create an empty table, myList, on the 2600B
my_instr.write("myList={}")

#index through and write them on by one to table variable in the Lua runtime environment
#Lua uses 1 based index vs. zero based for Python
#myLuaArray[i+1] = PythonArray[i]
for i in range(0, record_length):
     my_instr.write("myList[" + str(i+1) + "] = " + str(vector[i]))

#print out how many elements we have loaded into myList
print("Number of myList entries: " + my_instr.query("print(table.getn(myList))"))

You must be signed in to post in this forum.