Jump to content

Reading a CHUNK of data from the Oscilloscope with the instrumentation protocol

Recommended Posts


using the instrumentation protocol I was able to issue a "read command" to the Oscilloscope and receive the following message.


For your reference, this was the command i used to read from the oscilloscope:


I am having trouble decoding the data CHUNK of length 4876 bytes (130C). As far as I understand, the CHUNK is encoded using "I16" (from the docs : "The binary data type and resolution are defined in the device enumeration and units are in mV"). 

First of all, if I well understand the payload of the message above has 1218 characters, for a total of 9744 bytes, which does not seem to match with the 4876 mentioned before. Secondly, if I then take these ASCII values, convert them to integer and try to compute a single number using a pair of consecutive bytes,  the final number I get are not nearly close to the expected signal (which by the way is a square wave at 1kHz).

I guess my question is very simple, how is the CHUNK of data encoded? Can anybody give me an example of how to decode this data perhaps using the first few bytes in the payload above ("66AA8;;.....").

Thank you!

Link to comment
Share on other sites


You are correct that the binary data is 4876 bytes encoded as I16 in mV.  This data can be very misleading when you copy / paste it as text.  Many text editors will simply drop characters they cannot display.  Since the data coming back from the hardware is binary and not ASCII there are typically many non displayable characters.

Make sure you keep everything in binary until you convert it to I16.

If you're using JavaScript you can treat the incoming data as an ArrayBuffer and then create a I16 TypedArray 'view' of the data which is basically an I16 array.

Let us know if you have more questions about this.



Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...