Example #1
0
    def __init__ (self, channels = [0, 1], input_range = [1.0, 1.0]):
        """Oscilloscope application"""

        # instantiate both oscilloscopes
        self.channels = channels
        self.input_range = input_range

        # this will load the FPGA
        try:
            self.ovl = overlay()
        except ResourceWarning:
            print ("FPGA bitstream is already loaded")
        # wait a bit for the overlay to be properly applied
        # TODO it should be automated in the library
        time.sleep(0.5)

        # ocsilloscope channels
        self.osc = [self.channel(top = self, ch = ch, input_range = self.input_range[ch]) for ch in self.channels]
        
        # set parameters common to all channels
        for ch in channels:
            # trigger timing is in the middle of the screen
            self.osc[ch].trigger_pre  = self.size//2
            self.osc[ch].trigger_post = self.size//2

        # default trigger source
        self.t_source = 0

        # display widgets
        self.display()

        # threads
        self.jobs = bg.BackgroundJobManager()
        self.jobs.new('self.run()')
Example #2
0
    def __init__(self, channels=[0, 1]):
        """Generator application"""

        # instantiate both generators
        self.channels = channels

        # this will load the FPGA
        try:
            self.ovl = overlay()
        except ResourceWarning:
            print("FPGA bitstream is already loaded")
        # wait a bit for the overlay to be properly applied
        # TODO it should be automated in the library
        time.sleep(0.5)

        # generators
        self.gen = [self.channel(ch) for ch in self.channels]

        # display widgets
        for ch in self.channels:
            self.gen[ch].display()
Example #3
0
from redpitaya.overlay.mercury import mercury as overlay
fpga = overlay()

# First output code
gen0 = fpga.gen(0)
gen0.amplitude = 1.0
gen0.offset = 0.0
gen0.phase = 90
gen0.waveform = gen0.sin()

gen0.mode = 'PERIODIC'
gen0.frequency = 2e3

print ("Output 0 frequency:", gen0.frequency)

#First output get it running
gen0.reset()
gen0.start()
gen0.enable = True
gen0.trigger()

#Oscilloscope code

osc0 = fpga.osc(0, 1.0)
osc0.trigger_pre = 0
osc0.trigger_post = osc0.buffer_size
print ("osc0 buffer size:", osc0.buffer_size)

osc0.trig_src = 0

osc0.reset()