Skip to content

Commit

Permalink
Drive speaker continuously and collect 1 buffer of data
Browse files Browse the repository at this point in the history
  • Loading branch information
ange1a-j14 committed Jul 2, 2024
1 parent e3e69fd commit 9788e1b
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 2 deletions.
4 changes: 2 additions & 2 deletions acquire.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
print('Connected to ' + IP)

wave_form = 'sine'
freq = 200
ampl = 0.9
freq = 100
ampl = 0.5

# Reset Generation and Acquisition
rp_s.tx_txt('GEN:RST')
Expand Down
56 changes: 56 additions & 0 deletions acquire_continuous.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/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 = 100
ampl = 0.5

# 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=False)

# Enable output
rp_s.tx_txt('OUTPUT1:STATE ON')
rp_s.tx_txt('SOUR1:TRig:INT')

##### Acqusition #####
# Function for configuring Acquisition
rp_s.acq_set(dec=1)

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

# 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(chan=1, convert=True)

plt.plot(10*data)
plt.ylabel('Amplitude [V]')
plt.xlabel('Samples')
plt.show()

0 comments on commit 9788e1b

Please sign in to comment.