generate_two_burst_trigger_software.c 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /* Red Pitaya C API example Generating signal pulse on an external trigger
  2. * This application generates a specific signal */
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. #include <unistd.h>
  6. #include "rp.h"
  7. int main(int argc, char **argv) {
  8. /* Print error, if rp_Init() function failed */
  9. if(rp_Init() != RP_OK) {
  10. fprintf(stderr, "Rp api init failed!\n");
  11. }
  12. rp_GenWaveform(RP_CH_1, RP_WAVEFORM_SINE);
  13. rp_GenFreq(RP_CH_1, 4);
  14. rp_GenAmp(RP_CH_1, 1.0);
  15. rp_GenWaveform(RP_CH_2, RP_WAVEFORM_SINE);
  16. rp_GenFreq(RP_CH_2, 4);
  17. rp_GenAmp(RP_CH_2, 1.0);
  18. rp_GenMode(RP_CH_1, RP_GEN_MODE_BURST);
  19. rp_GenBurstCount(RP_CH_1, 2);
  20. rp_GenBurstRepetitions(RP_CH_1, 1);
  21. rp_GenBurstPeriod(RP_CH_1, 5000);
  22. rp_GenMode(RP_CH_2, RP_GEN_MODE_BURST);
  23. rp_GenBurstCount(RP_CH_2, 2);
  24. rp_GenBurstRepetitions(RP_CH_2, 1);
  25. rp_GenBurstPeriod(RP_CH_2, 5000);
  26. rp_GenOutEnableSync(true);
  27. rp_GenSynchronise();
  28. sleep(2);
  29. rp_GenTriggerOnly(RP_CH_1);
  30. sleep(2);
  31. rp_GenTriggerOnly(RP_CH_2);
  32. sleep(1);
  33. rp_GenSynchronise();
  34. rp_Release();
  35. }