Output a signal with every rising edge of an external trigger or RF-input signal
Posted: Wed Jan 31, 2024 5:25 pm
Hi everyone, I am new to the RedPitaya so sorry in advance if the issue is simple or too generic.
My goal is to input the RedPitaya a periodic signal (about 1 MHz, to be used as a clock or as a trigger) and output high or low DC voltages according to a predefined bitstream (zeros and ones) with every rising edge of the input signal.
So, the pseudocode is the following:
####
Receive input signal
If input signal voltage > some threshold voltage:
If bitstream == '1': Output DC_voltage_level = 1.0
else: Output DC_voltage_level = 0
###
As a first approach I thought about using python to generate the random bit string, waiting for the RedPitaya to be trigerred (both from the external trigger pins and from the RF input) and output a DC voltage corresponding to the bitstream, either 0 or 1 volts.
The core of my code was the following:
########
rp_s.tx_txt('SOUR1:TRIG:SOUR EXT_PE')
rp_s.tx_txt('SOUR:TRIG:EXT :DEBouncerUs 1')
rp_s.tx_txt(f"SOUR1:FUNC DC")
rp_s.tx_txt('OUTPUT:STATE ON')
try:
while 1:
rp_s.tx_txt('ACQ:TRIG:STAT?')
rp_s.tx_txt('SOUR1:TRIG:STAT?')
if rp_s.rx_txt() == 'TD':
voltage_level = 1.0 if bitstream == '1' else 0.0
rp_s.tx_txt(f"SOUR1:VOLT {voltage_level}")
i+=1
i %= len(bitstream)
rp_s.tx_txt('ACQ:RST')
except KeyboardInterrupt: print("You stopped the code")
########
This approach does not work as the triggering condition is not met on every rising edge. We also tried another approach where we received the input signal from the fast RF input (IN1) instead of the external trigger (EXT_PE) and tried to acquire every sample of the signal and use it to compare with the threshold, but that didn’t work either.
Could you please help me or indicate a possible approach to follow?
Thanks
My goal is to input the RedPitaya a periodic signal (about 1 MHz, to be used as a clock or as a trigger) and output high or low DC voltages according to a predefined bitstream (zeros and ones) with every rising edge of the input signal.
So, the pseudocode is the following:
####
Receive input signal
If input signal voltage > some threshold voltage:
If bitstream == '1': Output DC_voltage_level = 1.0
else: Output DC_voltage_level = 0
###
As a first approach I thought about using python to generate the random bit string, waiting for the RedPitaya to be trigerred (both from the external trigger pins and from the RF input) and output a DC voltage corresponding to the bitstream, either 0 or 1 volts.
The core of my code was the following:
########
rp_s.tx_txt('SOUR1:TRIG:SOUR EXT_PE')
rp_s.tx_txt('SOUR:TRIG:EXT :DEBouncerUs 1')
rp_s.tx_txt(f"SOUR1:FUNC DC")
rp_s.tx_txt('OUTPUT:STATE ON')
try:
while 1:
rp_s.tx_txt('ACQ:TRIG:STAT?')
rp_s.tx_txt('SOUR1:TRIG:STAT?')
if rp_s.rx_txt() == 'TD':
voltage_level = 1.0 if bitstream == '1' else 0.0
rp_s.tx_txt(f"SOUR1:VOLT {voltage_level}")
i+=1
i %= len(bitstream)
rp_s.tx_txt('ACQ:RST')
except KeyboardInterrupt: print("You stopped the code")
########
This approach does not work as the triggering condition is not met on every rising edge. We also tried another approach where we received the input signal from the fast RF input (IN1) instead of the external trigger (EXT_PE) and tried to acquire every sample of the signal and use it to compare with the threshold, but that didn’t work either.
Could you please help me or indicate a possible approach to follow?
Thanks