Using the acquisition channels as a trigger for generating pulses

Applications, development tools, FPGA, C, WEB
Post Reply
redpapaya
Posts: 2
Joined: Thu Mar 02, 2023 12:48 pm

Using the acquisition channels as a trigger for generating pulses

Post by redpapaya » Thu Mar 09, 2023 4:13 pm

Hi!

I'm new to working with the Red Pitaya and am currently having some issues with the trigger for the signal generator. I want to generate a signal from OUT1 based on a 10 Hz trigger-input on IN2.

I've tried the following however the time between input and output seems very large and not consistent (10-30 ms). Am I doing something wrong or is there another way of doing this?

Code: Select all

rp_s.tx_txt('GEN:RST')
rp_s.tx_txt('SOUR1:FUNC ARBITRARY')
rp_s.tx_txt('SOUR1:TRAC:DATA:DATA ' + waveform_ch_1)
rp_s.tx_txt('SOUR1:FREQ:FIX ' + str(freq))
rp_s.tx_txt('SOUR1:VOLT ' + str(Amp))
rp_s.tx_txt('SOUR1:BURS:STAT BURST')
rp_s.tx_txt('SOUR1:BURS:NCYC 1')
rp_s.tx_txt('SOUR1:BURS:NOR 1')
rp_s.tx_txt('OUTPUT1:STATE ON')
#rp_s.tx_txt('SOUR1:TRIG:INT')

rp_s.tx_txt('ACQ:RST')
rp_s.tx_txt('ACQ:DATA:FORMAT ASCII')
rp_s.tx_txt('ACQ:DATA:UNITS VOLTS')
rp_s.tx_txt('ACQ:DEC 1')
rp_s.tx_txt('ACQ:TRIG:LEV 0.5')
rp_s.tx_txt('ACQ:START')
rp_s.tx_txt('ACQ:TRIG CH2_PE')

t1_start = time.perf_counter()
while 1:
    rp_s.tx_txt('ACQ:TRIG:STAT?')
    if rp_s.rx_txt() == 'TD':
    	t1_stop = time.perf_counter()
    	print("Elapsed time between trigs:",(t1_stop-t1_start)) 

        # Trigger output
        rp_s.tx_txt('SOUR1:TRIG:INT')

        #Prepare ACQ
        rp_s.tx_txt('ACQ:START')
        rp_s.tx_txt('ACQ:TRIG CH2_PE')

        print('Trigger happened!')

    	t1_start = time.perf_counter()  

User avatar
redpitaya
Site Admin
Posts: 883
Joined: Wed Mar 26, 2014 7:04 pm

Re: Using the acquisition channels as a trigger for generating pulses

Post by redpitaya » Mon Mar 20, 2023 12:14 pm

First of all, I would like to apologize for my late reply. We were representing Red Pitaya at Embedded World the previous week.


I would suggest you set up the generator to work on the External trigger from pin DIO0_P. Then you can trigger the generator at 10 Hz without issues (please use a 3V3 CMOS signal as the external trigger).
https://redpitaya.readthedocs.io/en/lat ... al-trigger


The SCPI commands have a network delay, and the Linux on Red Pitaya does not operate in real-time, so you will experience delays if you send a lot of SCPI commands.

If you want the program to run as fast as possible or be very precise, I would suggest making a C program that can run on Red Pitaya itself.

redpapaya
Posts: 2
Joined: Thu Mar 02, 2023 12:48 pm

Re: Using the acquisition channels as a trigger for generating pulses

Post by redpapaya » Fri Mar 24, 2023 10:04 am

Thank you for the reply, and sorry for replying a bit late myself. I actually tried implementing the program in C afterwards as well however the results were still not to my liking. I've decided to go ahead with using the external trigger instead and it seems to work perfectly.

User avatar
redpitaya
Site Admin
Posts: 883
Joined: Wed Mar 26, 2014 7:04 pm

Re: Using the acquisition channels as a trigger for generating pulses

Post by redpitaya » Fri Mar 24, 2023 1:29 pm

I am glad that the issue was resolved.

Good luck with your project.

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: No registered users and 13 guests