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;
Nobody/Anonymous
None
None
Public
|
Date: 2008-05-02 20:58
|
|
Date: 2008-03-18 10:46
|
| Filename | Description | Download |
|---|---|---|
| TypeReadResp.java | Download |
| 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 |