Hi,
I'm trying to retrieve a waveform from an oscilloscope using StreamDevice, but I'm having some problems converting the binary data.
The scope sends the waveform raw data using the IEEE 488.2 definite length block format (a small ASCII header indicating how many bytes will be sent and right after that the binary data). For example, when it sends 3 16-bit points, the received
message is:
C1:WF DAT1,#9000000006<BIN1><BIN1><BIN2><BIN2><BIN3><BIN3>
I have the following records:
record(waveform, "$(P)$(R)Wfm1")
{
field(SCAN, "Passive")
field(DTYP, "stream")
field(FTVL, "SHORT")
field(INP, "@scope.proto read_wave_bin(C1, $(P)$(R)Wfm1ByteCount) $(PORT)")
field(NELM, "50")
}
record(ai, "$(P)$(R)Wfm1ByteCount")
{
field(DESC, "Waveform byte count channel 1")
}
And the following protocol function:
read_wave_bin {
separator="";
out "\$1:WF? DAT1";
in "\$1:WF DAT1,#9%(\$2)9d%02r";
}
But when I process this waveform record, I get the following error:
sevr=major readData LAB:SCP-02:Wfm1: can't convert from DBF_INT64 to DBF_SHORT
2020/02/04 17:25:01.657852 WAVEPRO LAB:SCP-02:Wfm1: Input "%<b8>/<b8>4<b8>" does not match format "%02r"
I can see that the "Wfm1ByteCount" record is being set correctly, matching the "#9000000006" string, so the problem is only on the binary matching/conversion.
I've tried changing the waveform FTVL type to INT64, but it still complains about the type conversion ("can't convert from DBF_INT64 to DBF_INT64").
Does anyone know how to fix this problem?
Thanks in advance,
Henrique Silva