Test and Measurement Forum

How to generate a signal and record it at the same time

Post your C and C++ discussions here

How to generate a signal and record it at the same time

Postby Iblard » Sun Mar 22, 2015 11:55 pm


I was wondering if it is possible to generate a signal, arbitrary or not, and at the same time or some small time later record it with the same osciloscope and how is this possible? I can afford to lose the first part of the signal if it is not possible to start to register at the same time the generated signal begins. I was reading the C api document for the 2008A model and I can not find a single function that can possible do this. I also read the example source code (ps2000acon) and there is are generating signal functions and registering functions but there are not a combination of both.

I tried using an arbitrary signal that is triggered by software, then setup a block trigggered and at the end call the software trigger to start the awg and maybe start the block registering function but I can only get garbage in the buffers. Maybe my signal is too small (1000 samples at 1hz) or I need to repeat it many times in order to let the registering function to catch it. I welcome sugestions.

Best regards,
Posts: 0
Joined: Sun Mar 22, 2015 10:51 pm

Re: How to generate a signal and record it at the same time

Postby Hitesh » Mon Mar 23, 2015 3:09 pm

Hi Iblard,

This is the general set of steps that I would recommend taking once you have set up the channels and read in the AWG waveform:

  • Call ps2000aSetSigGenArbitrary (set up a trigger for the signal generator if required, and specify 1 or more shots of the waveform)
  • Call ps2000aRunBlock
  • Use scope, external or ps2000aSigGenSoftwareControl to trigger the output of the AWG
  • Retrieve the data using ps2000aGetValues once the block callback indicates that data is available

You need to make sure that you set the correct number of samples and sampling interval in order to collect the data.

If you are having trouble getting this working, please post code snippets here.

Update: There is a guide to triggering the signal generator using the API functions - please refer to https://www.picotech.com/download/manuals/TriggeringAPicoScopeSignalGeneratorUsingThePicoScopeAPIFunctions.pdf

Last edited by Hitesh on Wed May 20, 2015 9:26 am, edited 1 time in total.
Reason: Added reference to Triggering a PicoScope Generator Using the PicoScope API Functions document

Technical Support Engineer
Site Admin
Site Admin
Posts: 2749
Joined: Tue May 31, 2011 3:43 pm
Location: St. Neots, Cambridgeshire

Re: How to generate a signal and record it at the same time

Postby jaray » Mon May 18, 2015 8:25 pm

Hitesh's method is essentially how I am doing it. I have an arm button that when pressed sets up the function generator, run block, and another piece of hardware I am using. Once I want to collect data I tell the run block to start, trigger my other piece of hardware, then trigger the arbitrary function generator. Work's great. I can get it to between 400 us and 1 msec of delay between starting the run block and starting the function generator.
Posts: 0
Joined: Wed Jan 14, 2015 8:47 pm

Return to C and C++

Who is online

Users browsing this forum: No registered users and 0 guests