frequency counter program in python

Just about everything about Red Pitaya
Post Reply
micjor375
Posts: 1
Joined: Fri Mar 02, 2018 9:46 am

frequency counter program in python

Post by micjor375 » Fri Mar 02, 2018 9:57 am

need to know python program to count no. of pulse in a square wave signal with frequency in Mhz range

the below program was able to measure and plot,buy i need to know no. of pulse in given timer interval
----
from redpitaya.overlay.mercury import mercury as overlay
fpga = overlay()
osc0 = fpga.osc(0, 1.0)        # channel index = 0 ­> IN1    or 1 ­> IN2
                               # voltage range = 1.0V (LV)   or 20.0V (HV) 
# data rate decimation 
osc0.decimation = 128
# trigger timing [sample periods]
N = osc0.buffer_size
osc0.trigger_pre  = 0
osc0.trigger_post = N
print (str(N) + " samples buffer size")
osc0.trig_src = 0              # disable hardware trigger sources
# synchronization and trigger sources are the default,
# which is the module itself
osc0.reset()
osc0.start()
osc0.trigger()
# wait for data
while (osc0.status_run()): pass
print ('triggered')
import matplotlib.pyplot as plt
# show only the part of the buffer requested by pre/post trigger timing
# plot data against sample number:
data = osc0.data(N)
plt.plot(data)
plt.show()
# plot data against time:
import numpy as np
t=np.linspace(0,16384*8E­9*osc0.decimation, 16384)
plt.plot(t,data)
plt.xlabel("t/s")
plt.ylabel("u/V")
plt.show()
------

Post Reply
jadalnie klasyczne ekskluzywne meble wypoczynkowe do salonu ekskluzywne meble tapicerowane ekskluzywne meble do sypialni ekskluzywne meble włoskie

Who is online

Users browsing this forum: Google [Bot] and 21 guests