Python SCPI: binary acquisition
Posted: Wed Apr 25, 2018 4:43 pm
I'm trying to acquire data from a fast analog output as continuously as possible using Python and the redpitaya_scpi.py module.
If I acquire ascii data, the delay time between successive acquisitions (with decimation = 1) is 250 ms.
What I do is:
I red around that it would be much faster if I could acquire in binary format, but if I read the buffer, the result is a boolean False.
In fact, if we look inside the function rp_s.rx_arb(), this is returning False if the first bit that the socket return is:
This is indeed the only thing that the socket read in the buffer.
The two sequences are identical, except for the requested data format. Why can I read ascii data and not binary? What am I doing wrong?
Thanks in advance
If I acquire ascii data, the delay time between successive acquisitions (with decimation = 1) is 250 ms.
What I do is:
Code: Select all
rp_s.tx_txt('ACQ:RST')
rp_s.tx_txt('ACQ:START')
rp_s.tx_txt('ACQ:TRIG NOW')
rp_s.tx_txt('ACQ:SOUR2:DATA?')
buff_string = rp_s.rx_txt()
buff_string = buff_string.strip('{}\n\r').replace(" ", "").split(',')
buff = list(map(float, buff_string))
Code: Select all
rp_s.tx_txt('ACQ:RST')
rp_s.tx_txt('ACQ:DATA:UNITS VOLTS')
rp_s.tx_txt('ACQ:DATA:FORMAT BIN')
rp_s.tx_txt('ACQ:START')
rp_s.tx_txt('ACQ:TRIG NOW')
rp_s.tx_txt('ACQ:SOUR2:DATA?')
databin = rp_s.rx_arb()
Code: Select all
b'#'
The two sequences are identical, except for the requested data format. Why can I read ascii data and not binary? What am I doing wrong?
Thanks in advance