Share

jGpibEnet

Tracker: Support Requests

5 binary transfer - ID: 1917956
Last Update: Comment added ( darrenw2112 )

Hi,

first, thank you for your work! It will allow members of our research group
to share the equipment and the software development whatever their
preferred OS is...

At the moment, I'm struggling with a tektronix 371, which is a curve tracer
for electronic components characterization. This machine returns a set of
datapoints when asked "Curve?" on the GPIB port. The format of the reply is

"CURVE CURVID: INDEX 0,%binary data"
where binary data is the number of points to follow (2 bytes), then we have
the X and Y values of each point (each stored on 2 bytes), and then a
checksum (1 byte).

each X and Y value comes from a 10-bit digitizer, so the values go from
0x000 to 0x3FF. Thus, the "little" byte has values ranging from 0x00 to
0xFF.

The problem, when I read the values through jGpibEnet is that values above
0x8F are erroneous. This is not just because java integers are signed (I
take care of that). I suspect a problem with string encoding: changing the
encoding used to convert the string read to bytes actually changes the
erroneous values (to another erroneous values, so the advantage is not
tremendous)

I'm a beginner in java programming, so maybe I'm doing something wrong. Do
you have an idea what?

here is a snippet of my code:

private int[] toIntArray(String rawCurve) {
// Now we start the dirty work to convert the data stream into a
table of int
// the tek371 generates 10-bit data coded with big endian on two
chars.

byte[] rawbytes =rawCurve.getBytes();
int[] read = new int[rawbytes.length/2];
for (int i = 0, n = rawbytes.length - 1, ptr = 0; ptr < n; i++,
ptr+=2) {

read[i] = (int)(((rawbytes[ptr] << 8) | (rawbytes[ptr+1] & 0xff
));

}
return read;


buttay ( cyrilbuttay ) - 2008-03-18 09:49

5

Closed

None

Nobody/Anonymous

None

None

Public


Comments ( 2 )




Date: 2008-05-02 20:58
Sender: darrenw2112Project Admin


Sorry for the delay, I am not receiving emails from this forum for some
reason. Why don't you send me an email of what you changed and i will look
at it and possibly include it in the next build.
darrenw2112@users.sourceforge.net



Date: 2008-03-18 10:46
Sender: cyrilbuttay


I've done a quick and dirty hack, which apparently works:

* I've added a readBinary() method in jGpibEnetDriver, which is an exact
copy of read(), except that it returns a byte array

* in TypeReadResp.java, I've stored the byte array before converting it to
a string, and I've added two methods, setBinaryData and getBinaryData.

As far as I'm concerned, I think you can consider my support request
closed, but feel free to tell me if a better method exists (one that
doesn't require hacking jGpibEnet...

Regards

Cyril
File Added: TypeReadResp.java


Log in to comment.

Attached File ( 1 )

Filename Description Download
TypeReadResp.java Download

Changes ( 3 )

Field Old Value Date By
status_id Open 2008-05-02 20:58 darrenw2112
close_date - 2008-05-02 20:58 darrenw2112
File Added 270867: TypeReadResp.java 2008-03-18 10:46 cyrilbuttay