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.

6221/2182a partial buffer reading

6220, 6221 Current Sources
Post Reply
Wallmaster489
Posts: 3
Joined: June 14th, 2016, 9:33 am
Country: United States

6221/2182a partial buffer reading

Post by Wallmaster489 » June 14th, 2016, 9:44 am

Using labwindows, when i request a buffer reading from the 6221 i only get the first 23 readings. Despite that when i manually view the buffer on the 6221 it has all the correct buffer reading values stores in there. I have no idea what the issue is any comments will be much appreciated.

Kenneth P
Keithley Applications
Keithley Applications
Posts: 212
Joined: October 25th, 2010, 1:31 pm
Country: United States
Contact:

Re: 6221/2182a partial buffer reading

Post by Kenneth P » June 14th, 2016, 10:15 am

How big of a buffer string are you using? I suggest that you use a value on the order of a few thousand. If you are using GPIB, the GPIB read will terminate at the EOI signal.
With so little information other than the brief description, it is going to be very difficult to determine where the problem may be occurring.
I suggest that you also use I/O Trace to record the I/O transactions for review.

Wallmaster489
Posts: 3
Joined: June 14th, 2016, 9:33 am
Country: United States

Re: 6221/2182a partial buffer reading

Post by Wallmaster489 » June 14th, 2016, 10:29 am

Oh sorry first time posting.

Okay yeah ill try that out. My buffer string is allocated like this inputBuffer = malloc((buffer*100)*sizeof(char)); where buffer is grabbed from user input and inputBuffer is a char*. This problem inconsistently occurs only when i use FORM:ELEM... with any parameters attached to it.

Dale C
Keithley Applications
Keithley Applications
Posts: 2849
Joined: June 10th, 2010, 6:22 am
Country: United States
Contact:

Re: 6221/2182a partial buffer reading

Post by Dale C » June 15th, 2016, 5:49 am

The complete string for all elements is about 87 bytes long. So you have to allow for enough bytes in the return string for each reading. The length depends on the FORMAT:ELEMENTS command.
Look at the attached screen shot from the manual.
Attachments
6221dataformat.png
6221dataformat.png (187.22 KiB) Viewed 22961 times

Wallmaster489
Posts: 3
Joined: June 14th, 2016, 9:33 am
Country: United States

Re: 6221/2182a partial buffer reading

Post by Wallmaster489 » June 15th, 2016, 8:01 am

Oh thanks for pointing that out, but as you can see from the way that i am allocating memory for this the input string, i am overcompensating by using 100 instead of 87. So my input string is allocated like this

input = malloc((buffer*100)*sizeof(char));

So lets say for example if buffer = 1000 my total array size is 100000, so I don't think array size is the issue here.

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

Re: 6221/2182a partial buffer reading

Post by Andrea C » June 16th, 2016, 4:44 am

I assume you are using VISA write and read functions to interact with the 6221.

The viRead() function has a buffer size parameter which will control how many bytes of data will be transferred. This is different than the allocation of a string array to receive the transferred data.

Check your NI program group from the Windows Start menu. Invoke the NIO Trace utility. This debugging tool will allow you to capture the bus interaction with the 6221. You will probably see that too few characters are being requested with the VISA read and thus you are getting only a portion of the available data.

http://zone.ni.com/reference/en-XX/help ... ttributes/

Post Reply

Return to “Current Sources”

Who is online

Users browsing this forum: No registered users and 2 guests