Test and Measurement Forum

Generate a signal using the GEN Output Channel

Post your MATLAB discussions here

Generate a signal using the GEN Output Channel

Postby Dome1985 » Thu Jun 26, 2014 2:34 pm

Hello all,

i am using the Picoscope 3206B to synchronize this measurement system (PicoScope : 1st) with another measurement system (2nd, it is not a PicoScope, but it has a Sync Input which needs a specific signal).
I connect PicoScope with the SDK of Matlab, i can capture data with channel A or/and B. And now i want to send a square signal with the same samplerate like the samplerate which i define to capture the data in PicoScope.

In the end i want to have one specific data (captured as example at channel A) to a specific time ( t1 ) and in addition to that i want to measure to the same specific time like (t1) an other information with the second measurement system ( 2nd).

How can I send a signal over the GEN Output with the same samplerate like PicoScope itself?

Second problem is, where do i have to call the following functions?

sig_gen_built_in_status = invoke(ps3000a_obj, 'ps3000aSetSigGenBuiltIn', ...
offsetVoltage, pkToPk, waveformType, startFrequency, stopFrequency, increment, ...
dwellTime, sweepType, operation, shots, sweeps, triggerType, triggerSource, ...
extInThreshold);

AND

status_set_siggen_arb = invoke(ps3000a_obj, 'ps3000aSetSigGenArbitrary', offsetVoltage, pkToPk, ...
start_delta, stop_delta, deltaPhaseIncrement, dwellCount, awg_waveform, waveform_size, ...
sweepType, operation, indexMode, shots, sweeps, triggerType, triggerSource, extInThreshold);



regarding the calling of the other functions when i capture the data:

...some code to set different functions: (setsimpletrigger, setChannel ...)...

while(RunStream) % Repeat until Power source is correct

streaming_status = invoke(app.ps3206B_obj, 'ps3000aRunStreaming', ....

end

while(hasAutoStopped == false && get_str_latest_values_status == PicoStatus.PICO_OK)

while(streamValue == false)

get_str_latest_values_status = invoke(app.ps3206B_obj, 'GetStreamingLatestValues');
streamValue = invoke(app.ps3206B_obj, 'IsReady');
...some more code like the example


end
end

My problem is, everytime Picoscope sample the buffer to get the data i want to send out a signal over the GEN Output.

Thanks for any help.

Dome
Dome1985
Newbie
 
Posts: 0
Joined: Thu Apr 03, 2014 9:19 am

Re: Generate a signal using the GEN Output Channel

Postby Karunen » Tue Jul 01, 2014 10:16 am

Hi Dome,

What sampling frequency will you using with the scope?

Please note the signal generator can only output up to 1 MHz and if you want a clean square wave you will the maximum frequency you can use is 200 kHz.

You need to call

Code: Select all
sig_gen_built_in_status = invoke(ps3000a_obj, 'ps3000aSetSigGenBuiltIn', ...
offsetVoltage, pkToPk, waveformType, startFrequency, stopFrequency, increment, ...
dwellTime, sweepType, operation, shots, sweeps, triggerType, triggerSource, ...
extInThreshold);


or

Code: Select all
status_set_siggen_arb = invoke(ps3000a_obj, 'ps3000aSetSigGenArbitrary', offsetVoltage, pkToPk, ...
start_delta, stop_delta, deltaPhaseIncrement, dwellCount, awg_waveform, waveform_size, ...
sweepType, operation, indexMode, shots, sweeps, triggerType, triggerSource, extInThreshold);


Before you call runstreaming.

Please note you do not need to use both the built in signal generator and the arbitrary generator functions.

I am not sure I understand
My problem is, everytime Picoscope sample the buffer to get the data i want to send out a signal over the GEN Output.


Do you mean every time the scope samples the signal or every time a section of data is collected?

Kind Regards,
Karunen

Technical Specialist
Pico Technology
Karunen
Zen Master
Zen Master
 
Posts: 194
Joined: Thu Nov 21, 2013 9:22 am

Re: Generate a signal using the GEN Output Channel

Postby Dome1985 » Thu Jul 03, 2014 6:41 am

Hello,

thanks for your help, it makes a few things clear.

I meant, that every time PicoScope samples the buffer, let´s say a sampletime of PicoScope is 50 us then i want to to generate a signal (not specific a rectangular one) which has a rising edge, and the time difference between the rising edges should be also 50 us. I want to send another measuremen system a signal which should tell him, PicoScope gets data every x-times and please do the same and this as precisely as possible.

If you have any other idea to create such a signal rather than a rectangular one, don´t hesitate to describe it here :).

Thanks for any help.

Dome
Dome1985
Newbie
 
Posts: 0
Joined: Thu Apr 03, 2014 9:19 am

Re: Generate a signal using the GEN Output Channel

Postby Karunen » Thu Jul 03, 2014 10:56 am

Hi Dome,

Unfortunately this is not possible the current devices.

The rising edge of the output signal will not coincide with when the Scope samples the data.

This is because they are not started at the same time and therefore it would be very difficult to get the two events to occur at the same time.

Also the sampling and the AWG use the clock differently so they will not have exactly the same frequency.

Kind Regards,
Karunen

Technical Specialist
Pico Technology
Karunen
Zen Master
Zen Master
 
Posts: 194
Joined: Thu Nov 21, 2013 9:22 am

Re: Generate a signal using the GEN Output Channel

Postby Dome1985 » Thu Jul 03, 2014 11:34 am

Hello,

ok i understand. My system is a little bit difficult. I have sent "Hitesh" a drawing of my system. If you have contact to him, please get some information about my system.

Do you know any kind of way how i can synchronize another system (it is a high speed camera) with PicoScope? My idea was to send a rectangular signal with the same samplerate as PicoScope to the camera system, so the camera will take pictures every x-times as the rising edge appears of the regtangular signal. Problem here: If you say that PicoScope will not sample every 50 us the buffer to get the data, i have no reliable picture to the data of the signal which i process with PicoScope.

Dome1985
Dome1985
Newbie
 
Posts: 0
Joined: Thu Apr 03, 2014 9:19 am

Re: Generate a signal using the GEN Output Channel

Postby Karunen » Thu Jul 03, 2014 3:19 pm

Hi Dome,

I will read through the information you sent Hitesh and will respond via helpdesk.

Kind Regards,
Karunen

Technical Specialist
Pico Technology
Karunen
Zen Master
Zen Master
 
Posts: 194
Joined: Thu Nov 21, 2013 9:22 am

Re: Generate a signal using the GEN Output Channel

Postby Dome1985 » Fri Jul 04, 2014 8:21 am

Hi Karunen,

sounds good, thank you.

Maybe somebody else is also interested in generating a signal using GEN Output channel when a trigger occurs at the EXT In Channel.

For some reason my GEN Channel sends the signal when i call the function, it is not waiting for the trigger, what did i wrong?

Declaration:

pkToPk = 4000000; %microVolts
offsetVoltage = 0; %microVolts
waveformType = app.enuminfo.enPS3000AWaveType.PS3000A_SINE;
startFrequency = 100000;
stopFrequency = 100000;
increment = 0;
dwellTime = 0;
sweepType = enuminfo.enPS3000ASweepType.PS3000A_DOWNUP;
operation = enuminfo.enPS3000AExtraOperations.PS3000A_ES_OFF;
shots = 4294967295;
sweeps = 4294967295;
triggerType = enuminfo.enPS3000ASigGenTrigType.PS3000A_SIGGEN_RISING;
triggerSource = enuminfo.enPS3000ASigGenTrigSource.PS3000A_SIGGEN_EXT_IN;
extInThreshold = int16(mv2adc(0, 3500, ps3000a_obj.maxValue));

Then i call this function as you describend right in front of runstreaming:
...
RunStream = true;
while(RunStream)

sig_gen_built_in_status = invoke(ps3000_obj, 'ps3000aSetSigGenBuiltIn', ...
offsetVoltage, pkToPk, ...
waveformType, startFrequency, ...
stopFrequency, increment, ...
dwellTime,sweepType, ...
operation, shots, ...
sweeps, triggerType, ...
triggerSource, extInThreshold);

streaming_status = invoke(app.ps3206B_obj, 'ps3000aRunStreaming', ...
...

I also tried to call this function before the while loop starts. But it doesn´t work.

Thanks for any help.

Dome
Dome1985
Newbie
 
Posts: 0
Joined: Thu Apr 03, 2014 9:19 am

Re: Generate a signal using the GEN Output Channel

Postby Hitesh » Fri Jul 04, 2014 11:22 am

Hi Dome,

You appear to have set a number of shots and sweeps.

If a number of sweeps is set, the signal generator will output at the start frequency until the trigger occurs.

I suggest the following:

Code: Select all
shots = 4294967295;
sweeps = 0;
...
extInThreshold = int16(mv2adc(0, 5000, ps3000a_obj.maxValue));


Note that the External Input range is +/-5V.

Hope this helps.
Hitesh

Technical Specialist
Pico Technology
Hitesh
Site Admin
Site Admin
 
Posts: 2063
Joined: Tue May 31, 2011 3:43 pm
Location: St. Neots, Cambridgeshire

Re: Generate a signal using the GEN Output Channel

Postby Dome1985 » Fri Jul 04, 2014 12:11 pm

Hello,

unfortunately it still doesn´t work. I changed as you described the sweeps variable to = 0;
This signal will be generated when i am calling the runstreaming function, even i have defined the triggersource to EXT IN.
My EXT In signal is a 0-5 V TTL level, and the variable is where it should react when the trigger occurs is in this range. (-> 5V)

Did anybody else already have an example or more advices?

Thanks.

Dome
Dome1985
Newbie
 
Posts: 0
Joined: Thu Apr 03, 2014 9:19 am

Re: Generate a signal using the GEN Output Channel

Postby mozdas » Fri Jan 23, 2015 4:44 pm

Dear All,
I am trying to do something similar to what you do. Did you find any solution?
What I want to do is, send a signal from Picoscope which tiggers Agilent Signal Generator. The Gen output of Picoscope will be Connected to Sync input of the Agilent Signal Generator.
My signal can be a set of 0s and 1s with a specified period.
Everytime I want to first Trigger Agilen Sig Generator with Picoscope and then measure another signal with Picoscope in Matlab.

I would appreciate if you could help on this.
Regards
mozdas
Newbie
 
Posts: 0
Joined: Thu Jan 22, 2015 12:06 am

Re: Generate a signal using the GEN Output Channel

Postby Hitesh » Mon Feb 02, 2015 12:23 pm

Hi,

This is a suggested approach following correspondence via our Tech Support Skype address:

Initialisation

  • Setup the channels as required
  • Call ps3000aSetSimpleTrigger and for the channel parameter pass ps3000aEnuminfo.enPS3000AChannel.PS3000A_EXTERNAL

Data collection

  • Loop
  • Call ps3000aSetSigGenArbitrary, and set the triggerSource to ps3000aEnuminfo.enPS3000ASigGenTrigSource.PS3000A_SIGGEN_SOFT_TRIG
  • Call ps3000aRunBlock
  • Call the ps3000aSigGenSoftwareControl, setting the state to 1 to trigger the signal generator
  • Poll ps3000aIsReady until the device has collected data
  • Call ps3000aStop
  • Use the ps3000aGetValues function to retrieve the data and store elsewhere
  • Repeat loop

Disconnection

  • Disconnect from the device when complete.

Regards,
Hitesh

Technical Specialist
Pico Technology
Hitesh
Site Admin
Site Admin
 
Posts: 2063
Joined: Tue May 31, 2011 3:43 pm
Location: St. Neots, Cambridgeshire


Return to MATLAB

Who is online

Users browsing this forum: No registered users and 1 guest