Skip to content

Commit

Permalink
tested scope acquisition from Red Pitaya
Browse files Browse the repository at this point in the history
  • Loading branch information
npeard committed May 16, 2024
1 parent fe93fd6 commit 2ac0db8
Show file tree
Hide file tree
Showing 3 changed files with 1,123 additions and 0 deletions.
53 changes: 53 additions & 0 deletions acquire.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/usr/bin/env python3

import sys
import time
import matplotlib.pyplot as plt
import redpitaya_scpi as scpi

IP = 'rp-f0c04a.local'
rp_s = scpi.scpi(IP)
print('Connected to ' + IP)

wave_form = 'sine'
freq = 1000000
ampl = 1

# Reset Generation and Acquisition
rp_s.tx_txt('GEN:RST')
rp_s.tx_txt('ACQ:RST')

##### Generation #####
# Function for configuring Source
rp_s.sour_set(1, wave_form, ampl, freq, burst=True, ncyc=3)

##### Acqusition #####
# Function for configuring Acquisition
rp_s.acq_set(dec=1, trig_lvl=0, trig_delay=0)

rp_s.tx_txt('ACQ:START')
time.sleep(1)
rp_s.tx_txt('ACQ:TRig AWG_PE')
rp_s.tx_txt('OUTPUT1:STATE ON')
time.sleep(1)

rp_s.tx_txt('SOUR1:TRig:INT')

# Wait for trigger
while 1:
rp_s.tx_txt('ACQ:TRig:STAT?') # Get Trigger Status
if rp_s.rx_txt() == 'TD': # Triggerd?
break

## ! OS 2.00 or higher only ! ##
while 1:
rp_s.tx_txt('ACQ:TRig:FILL?')
if rp_s.rx_txt() == '1':
break

# Read data and plot
# function for Data Acquisition
data = rp_s.acq_data(1, convert= True)

plt.plot(data)
plt.show()
25 changes: 25 additions & 0 deletions blink.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env python3

import sys
import time
import redpitaya_scpi as scpi

IP = 'rp-f0c04a.local'
rp_s = scpi.scpi(IP)

if (len(sys.argv) > 2):
led = int(sys.argv[2])
else:
led = 0

print ("Blinking LED["+str(led)+"]")

period = 1 # seconds

while 1:
time.sleep(period/2.0)
rp_s.tx_txt('DIG:PIN LED' + str(led) + ',' + str(1))
time.sleep(period/2.0)
rp_s.tx_txt('DIG:PIN LED' + str(led) + ',' + str(0))

rp_s.close()
Loading

0 comments on commit 2ac0db8

Please sign in to comment.