Software triggered generator operation (3204A)

Post general discussions on using our drivers to write your own software here
va3ttn
Newbie
Posts: 0
Joined: Tue Nov 20, 2012 4:44 pm

Software triggered generator operation (3204A)

Post by va3ttn »

"Programmer's Guide" describes "software triggered generator operation"
in a way that leads one to believe that the generator can be triggered
by calling SigGenSoftwareControl after SetSigGenBuiltIn.

Here's what the guide says about SetSigGenBuiltIn and SigGenSoftwareControl.

ps3000aSetSigGenBuiltIn:
PS3000A_SIGGEN_SOFT_TRIG : wait for software trigger provided by ps3000aSigGenSoftwareControl

ps3000aSigGenSoftwareControl:
This function causes a trigger event, or starts and stops gating.
It is used when the signal generator is set to SIGGEN_SOFT_TRIG.

state:
sets the trigger gate high or low when the trigger type is set
to either SIGGEN_GATE_HIGH or SIGGEN_GATE_LOW.
Ignored for other trigger types.


However, when I call SetSigGenBuiltIn (right after OpenUnit)
with triggerSource=SIGGEN_SOFT_TRIG and triggerType=SIGGEN_RISING
or SIGGEN_FALLING, the generator starts immediately,
and calling SigGenSoftwareControl subsequently has no effect

Which one is wrong: my reading of the Guide, or the behavour that I see?

Sinisa

Hitesh

Re: Software triggered generator operation (3204A)

Post by Hitesh »

Hi Sinisa,

The trigger can be used for the signal generator when a number of shots or sweeps of the waveform are required.

Have you set a number of shots or sweeps?

Try setting the triggerType to SIGGEN_GATE_HIGH and try the state values of 0 and 1.

I'll look further into this and provide an updaet if you are unable to get this working.

Hope this helps.

va3ttn
Newbie
Posts: 0
Joined: Tue Nov 20, 2012 4:44 pm

Re: Software triggered generator operation (3204A)

Post by va3ttn »

Hitesh wrote:The trigger can be used for the signal generator when a number of shots or sweeps of the waveform are required."
Does that mean that trigger has no use for ordinary operation (no sweeps, no shots)?

Both SIGGEN_GATE_HIGH and SIGGEN_GATE_LOW work as expected, but I was
confused by the absence of any observable effect of SIGGEN_RISING and SIGGEN_FALLING.

Sinisa

Hitesh

Re: Software triggered generator operation (3204A)

Post by Hitesh »

Hi Sinisa,

Unless the number of shots or sweeps (not both) has been set to non-zero, the signal generator can not be triggered. However, if you set the number of shots or sweeps to PS3000A_SHOT_SWEEP_TRIGGER_CONTINUOUS_RUN then you should be able to output a signal continuously.

Gate High starts the Scope capturing and Gate Low Stops the signal generator, once gate HIGH has been sent the signal generator will continue until the gate low is called.

If you use SIGGEN_RISING or SIGGEN_FALLING, then you should be able to call the ps3000aSigGenSoftwareControl function with state set to a value to trigger the signal generator.

Which version of the PS3000a.dll are you using?

Regards,

ARC
Newbie
Posts: 0
Joined: Wed Aug 08, 2012 8:38 am

Re: Software triggered generator operation (3204A)

Post by ARC »

Hello,

I'm trying to produce a continuous stream from Sig gen built in on 2206 and I can't.

I have defined

Code: Select all

#define PS2000A_SHOT_SWEEP_TRIGGER_CONTINUOUS_RUN 0xFFFFFFFF
in ps2000aApi.h after PS2000A_MIN_ANALOGUE_OFFSET_5V_20V.

Then my set sig gen built in call (for white noise) looks like this

Code: Select all

status = ps2000aSetSigGenBuiltIn(unit.handle, offset, pktopk, waveform, (float)frequency, (float)frequency, 0, 0, (PS2000A_SWEEP_TYPE) 0, PS2000A_WHITENOISE, PS2000A_SHOT_SWEEP_TRIGGER_CONTINUOUS_RUN, 0, PS2000A_SIGGEN_RISING, PS2000A_SIGGEN_SOFT_TRIG, 0);
followed by

Code: Select all

status = ps2000aSigGenSoftwareControl(unit.handle, 1);
but the output doesn't change when calling any of the built in functions.

What am i doing wrong?

Hitesh

Re: Software triggered generator operation (3204A)

Post by Hitesh »

Hi,

In the Programmer's manual, the description relating to White Noise is as follows:
PS2000A_WHITENOISE, the signal generator produces white noise and ignores all settings except pkToPk and offsetVoltage.
This would mean that any trigger settings are ignored as well. This is an operation enumeration rather than a wavetype. The alternative is create your own white noise file (e.g. feed the signal back in using PicoScope 6) and use the ps2000aSetSigGenArbitrary function instead to output the noise.

I hope this helps.

ARC
Newbie
Posts: 0
Joined: Wed Aug 08, 2012 8:38 am

Re: Software triggered generator operation (3204A)

Post by ARC »

Ok,

So can you software trigger PRBS continuously, like below, until stopped by software trigger?

Thanks

Hitesh

Re: Software triggered generator operation (3204A)

Post by Hitesh »

Hi,

Yes you can. I've tested it using the PS2000A_SIGGEN_GATE_HIGH enumeration.

You can then call the ps2000aSigGenSoftwareControl with 1 or 0 to turn it on or off.

Regards,

ARC
Newbie
Posts: 0
Joined: Wed Aug 08, 2012 8:38 am

Re: Software triggered generator operation (3204A)

Post by ARC »

OK so SIGGEN RISING is wrong. I have changed the function call and it still doesn't work, its reporting error code 46.

Code: Select all

status = ps2000aSetSigGenBuiltIn(unit.handle, offset, pktopk, waveform, (float)frequency, (float)frequency, 0, 0, (PS2000A_SWEEP_TYPE) 0, PS2000A_PRBS, PS2000A_SHOT_SWEEP_TRIGGER_CONTINUOUS_RUN, 0, PS2000A_SIGGEN_GATE_HIGH , PS2000A_SIGGEN_SOFT_TRIG, 0);
my values are:
offset = 0
pktopk = 2000000
waveform = 0
both frequencies are 100

Any ideas?

Thanks,

Hitesh

Re: Software triggered generator operation (3204A)

Post by Hitesh »

That's pretty much what I have for my parameters with the exception of casting the sweep type.

The error code 46 (Hex 2E) indicates that a signal generator parameter might be out of range.

What version of the ps2000a.dll are you using and if you turn off the PRBS do you get a continuous sine wave until you set the state in ps2000aSigGenSoftwareControl to 0?

Below is the portion of code I am using:

Code: Select all

status = ps2000aSetSigGenBuiltIn(unit.handle, offset, pkpk, waveform, (float)frequency, (float)frequency, 0, 0, 0, PS2000A_PRBS, PS2000A_SHOT_SWEEP_TRIGGER_CONTINUOUS_RUN, 0, PS2000A_SIGGEN_GATE_HIGH, PS2000A_SIGGEN_SOFT_TRIG, 0);
		
printf(status?"\nps2000aSetSigGenBuiltIn: Status Error 0x%x \n":"", (unsigned int)status);		
// If status != 0, show the error

status = ps2000aSigGenSoftwareControl(unit.handle, 1);

Sleep(5000);

status = ps2000aSigGenSoftwareControl(unit.handle, 0);

gmockly
Newbie
Posts: 0
Joined: Mon Nov 18, 2013 4:07 pm

Re: Software triggered generator operation (3204A)

Post by gmockly »

Sorry to bump an old thread but my issue is close to the first one here.

I am trying to trigger signals on a 3205B but contrary to what the programmer's guide says, the signal starts immediately when using PS3000A_SIGGEN_GATE_HIGH and PS3000A_SIGGEN_SOFT_TRIG as the trigger condition and trigger source.

When I use PS3000A_SIGGEN_RISING as trigger condition, the generator waits for ps3000aSigGenSoftwareControl to set PS3000A_SIGGEN_GATE_HIGH to start the signal but then, setting the gate to PS3000A_SIGGEN_GATE_HIGH does not stop it and I need to set a 0V DC signal.

Is this behaviour correct or a bug in my version of the dlls ?
The version for ps3000a.dll is 1.0.0.386.

On a side note, when starting the picoscope, the signal generator emits a DC signal at -2.5V.
Is this an expected behaviour ?

Martyn
Site Admin
Site Admin
Posts: 4491
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Software triggered generator operation (3204A)

Post by Martyn »

I am not aware of an issue with the driver. Can you post a code snippet so that we can check that the calls are correct.
Martyn
Technical Support Manager

gmockly
Newbie
Posts: 0
Joined: Mon Nov 18, 2013 4:07 pm

Re: Software triggered generator operation (3204A)

Post by gmockly »

Here is how I started to generate a signal.

Code: Select all

    PICO_STATUS rv=PICO_OK;

    rv=ps3000aSetSigGenBuiltIn(handle,0,4000000,PS3000A_SINE,50000,50000,0,1,
                                                  PS3000A_UP,
                                                  PS3000A_ES_OFF,
                                                  PS3000A_SHOT_SWEEP_TRIGGER_CONTINUOUS_RUN,
                                                  0,
                                                  PS3000A_SIGGEN_GATE_HIGH,
                                                  PS3000A_SIGGEN_SOFT_TRIG,
                                                  0);

    rv=ps3000aSigGenSoftwareControl(handle, PS3000A_SIGGEN_GATE_HIGH);
    if(rv!=PICO_OK)
    {
        printf("Error Start: 0x%08lx", rv);
        return;
    }

    Sleep(10000);

    rv=ps3000aSigGenSoftwareControl(handle, PS3000A_SIGGEN_GATE_LOW);
    if(rv!=PICO_OK)
    {
        printf("Error Stop: 0x%08lx", rv);
        return;
    }
With this code, when I inserted a capture between SetSigGenBuiltIn and SigGenSoftwareControl, I noticed that the sine was being generated.

The code I have now looks like this:

Code: Select all

    PICO_STATUS rv=PICO_OK;

    rv=ps3000aSetSigGenBuiltIn(handle,0,4000000,PS3000A_SINE,50000,50000,0,1,
                                                  PS3000A_UP,
                                                  PS3000A_ES_OFF,
                                                  PS3000A_SHOT_SWEEP_TRIGGER_CONTINUOUS_RUN,
                                                  0,
                                                  PS3000A_SIGGEN_RISING,
                                                  PS3000A_SIGGEN_SOFT_TRIG,
                                                  0);

    rv=ps3000aSigGenSoftwareControl(handle, PS3000A_SIGGEN_GATE_HIGH);
    if(rv!=PICO_OK)
    {
        printf("Error Start: 0x%08lx", rv);
        return;
    }

    Sleep(10000);

    rv=ps3000aSetSigGenBuiltIn(handle,0,0,PS3000A_DC_VOLTAGE,50000,50000,0,1,
                                                      PS3000A_UP,
                                                      PS3000A_ES_OFF,
                                                      PS3000A_SHOT_SWEEP_TRIGGER_CONTINUOUS_RUN,
                                                      0,
                                                      PS3000A_SIGGEN_GATE_HIGH,
                                                      PS3000A_SIGGEN_SOFT_TRIG,
                                                      0);
    if(rv!=PICO_OK)
    {
        printf("Error Stop: 0x%08lx", rv);
        return;
    }

Hitesh

Re: Software triggered generator operation (3204A)

Post by Hitesh »

Hi,

There is a more recent version of the ps3000a.dll file in the latest SDK.

Are you looking to output a continuous run of waveforms or just a finite number of shots. I can see that you are using the
PS3000A_SHOT_SWEEP_TRIGGER_CONTINUOUS_RUN parameter.
When I use PS3000A_SIGGEN_RISING as trigger condition, the generator waits for ps3000aSigGenSoftwareControl to set PS3000A_SIGGEN_GATE_HIGH to start the signal but then, setting the gate to PS3000A_SIGGEN_GATE_HIGH does not stop it and I need to set a 0V DC signal.
Do you mean PS3000A_SIGGEN_GATE_LOW in order to turn off the signal?

Have you tried using the external trigger instead of the software trigger?

Regards,

gmockly
Newbie
Posts: 0
Joined: Mon Nov 18, 2013 4:07 pm

Re: Software triggered generator operation (3204A)

Post by gmockly »

My goal is to generate a continuous run of waveforms and to stop them by software.
I only tried with the software trigger because the external trigger will not be a use case in my application but I will try to see if the behaviour changes with a different trigger.

And yes, I meant PS3000A_SIGGEN_GATE_LOW when trying to stop the signal, thank you for noticing the typo.

I will try with the latest version of the SDK.

Post Reply