I am currently using the Red Pitaya 125-14 with SCPI commands and Python. I have a generator function connected to input 1 of the Red Pitaya, which continuously generates pulses. The idea is that when the Red Pitaya detects a voltage rise above a certain threshold, it activates the digital signal DIO0_P.
When I use the oscilloscope, I can see that the digital signal activates every time I run the program. However, the issue is that the signal activation occurs at a different time compared to the rising signal for each run of the programme I do.
I have attached the code:
Code: Select all
#!/usr/bin/env python3
import sys
import time
import redpitaya_scpi as scpi
#Setup the connection to the Red Pitaya
rp_s = scpi.scpi(sys.argv[1])
# RST on GEN and DIG
rp_s.tx_txt('DIG:RST')
rp_s.tx_txt('ACQ:RST')
# DIO0_P as output
rp_s.tx_txt('DIG:PIN:DIR OUT,DIO0_P')
# Acquisition
rp_s.tx_txt('ACQ:TRIG:LEV 0.5')
rp_s.tx_txt('ACQ:TRIG:DLY 0')
rp_s.tx_txt('ACQ:DEC 1')
rp_s.tx_txt('ACQ:START')
time.sleep(0.1)
rp_s.tx_txt('ACQ:TRIG CH1_PE')
rp_s.tx_txt('DIG:PIN DIO0_P,1')
# Wait for trigger
while 1:
rp_s.tx_txt('ACQ:TRIG:STAT?') # Get Trigger Status
if rp_s.rx_txt() == 'TD':
break
