generate_continuous.c 754 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /* Red Pitaya C API example Generating continuous signal
  2. * This application generates a specific signal */
  3. #include <stdio.h>
  4. #include <stdint.h>
  5. #include <stdlib.h>
  6. #include <unistd.h>
  7. #include "rp.h"
  8. int main(int argc, char **argv){
  9. /* Print error, if rp_Init() function failed */
  10. if(rp_Init() != RP_OK){
  11. fprintf(stderr, "Rp api init failed!\n");
  12. }
  13. /* Reset generator */
  14. rp_GenReset();
  15. /* Generating wave form */
  16. rp_GenWaveform(RP_CH_1, RP_WAVEFORM_SINE);
  17. /* Generating frequency */
  18. rp_GenFreq(RP_CH_1, 10000.0);
  19. /* Generating amplitude */
  20. rp_GenAmp(RP_CH_1, 1.0);
  21. /* Enable channel */
  22. rp_GenOutEnable(RP_CH_1);
  23. /* Generating trigger */
  24. rp_GenTriggerOnly(RP_CH_1);
  25. /* Releasing resources */
  26. rp_Release();
  27. return 0;
  28. }