uaiti Posted May 17, 2018 Share Posted May 17, 2018 Hi, using the instrumentation protocol I was able to issue a "read command" to the Oscilloscope and receive the following message. 113 {"osc":{"1":[{"command":"read","statusCode":0,"binaryOffset":0,"binaryLength":4876,"acqCount":220,"actualSampleFreq":24381324,"pointOfInterest":2062,"triggerIndex":0,"triggerDelay":84572929674,"actualTriggerDelay":84572929674,"actualVOffset":43,"actualGain":0.25,"wait":0}]}} 130C 66AA8;;68>8>DD>;;;>A;A>;G;>8;;6>6A;6;3DD;;8GAA8;;>>AD;D;8>A;86G;DA3;8>8;>ADA>;GG;AA;8;8>A3A>G68A>>>8>6686>D;;>A;DG;D88;A>8;;;8>A>>8>>A8A86D>83D386;;>>>>8A;;AA8;A;;>6;G>D>;>>3J>>A6AD88;AAG3;>DA>;;8>;88>A>>AD6;6;AAG;;;6>D;6>68A>>>>8>88;;DA>A;;;AA8>A66>6>D;;>>;8686A>>8;A>;;AA;8;;A;D>A>8;A>A8A3>3GD>>>A>>D8A8A838AAD>AA;A86>;D>88A;A;3;3D>3D>88A8>;8;J;6>>>A6GA8;;688D>;>A>>883;DA88D>6;J86>;;>>A;>;>>;D3>6>;DADA>>A;A;;;8D8AA>;>;;A;>>>A;A6>;A6>88DADA>>6>8>A8D>;;>;3DD>A6>>A;;8>AJ36;8>D8A>>>;;>A83A6;;;;;3;88DA>68>;>3DAA>;;6AD>6>>>>DD;A8A;A6AG>;>3;D;A8G;8D>;>>;>D63>8>;>8D6;ADA;>>;AA>>ADA3>8DA>>66;D>;A>68;D>>;D8>;A;6D;8AA;>6A>>>A8>6D8>;>38;A8;8;>>;;>;A6;>>6D3;AD>>A;88D;;AA;A;>;8>;;8;8A>AD;D>8>>;>D;66D0>>386D>;DA>>;>3;AA8>;G88>>>688DAA>>;>>>>>;686>668A8>D>>A>8AA8;;;>>>A68G>>AA;>;;>D88;8>;>A68>8AD6G;D>;;;AD;88>8D;>AAA>8DA;88;6D8A>AA>A>6>;>>D88ADA>>D;A>8>A;AA;8;6>6;A8J;;>8;;;;GA8>D>8A>A>>;;>;>DA;;A;8;6A>6;8GAA>A>688A;8;383D>6A6>8>GD886;AAA;>A;A>;;AD6>3>>>83G3>D>;;;>;>8G>6A>>6;;>>->D;8>68>;6DGA8A86>A-8;;>3A8;8;A66;;;;D>68A;8>88AA>A;>8;;6;>8;8G>A8;>>;>>8;D;;AA;3>A6;D>>>;;>D;8D;A8;A;>8;DAG;68G86>>D>A6;A8>D8;>;;>A;;6D;6>6>8A>A;8D>;A;>>>6;6>>>A>>G8>;>;>8D8>86DDD>8D;;A63D6;A;>;86;8;D8;>DA;D;>>>JD88;>G>;A;>;>>A8DD6AAA>;8>>A 0 For your reference, this was the command i used to read from the oscilloscope: {"osc":{"1":[{"command":"read","acqCount":101}]}} 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 More sharing options...
Kristoff Posted May 18, 2018 Share Posted May 18, 2018 Hey, 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. Thanks! -Kristoff Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.