No support of the AWG...

Post your .Net discussions here
Post Reply
andurimees
Newbie
Posts: 0
Joined: Tue Sep 23, 2014 9:20 am

No support of the AWG...

Post by andurimees »

In the C# versions of the SDK the function
"ps2000aSetSigGenArbitrary" is not part of the DLL calls as well as a Sweep Type is not implemented.
According to page 46 of the programmer manual this function should be present.
How else can one program the AWG using c#?

Yours
Harald

Karunen
Advanced User
Advanced User
Posts: 194
Joined: Thu Nov 21, 2013 9:22 am

Re: No support of the AWG...

Post by Karunen »

Hi Harald,

In the PS2000AImports.cs file you will want to copy and paste the following into the 'Driver enums' region

Code: Select all

       public enum IndexMode : int
        {
            PS2000A_SINGLE,
            PS2000A_DUAL,
            PS2000A_QUAD,
            PS2000A_MAX_INDEX_MODES
        }

        public enum WaveType : int
        {
            PS2000A_SINE,
            PS2000A_SQUARE,
            PS2000A_TRIANGLE,
            PS2000A_RAMP_UP,
            PS2000A_RAMP_DOWN,
            PS2000A_SINC,
            PS2000A_GAUSSIAN,
            PS2000A_HALF_SINE,
            PS2000A_DC_VOLTAGE,
            PS2000A_WHITE_NOISE,
            PS2000A_MAX_WAVE_TYPES
        }

        public enum SweepType : int
        {
            PS2000A_UP,
            PS2000A_DOWN,
            PS2000A_UPDOWN,
            PS2000A_DOWNUP,
            PS2000A_MAX_SWEEP_TYPES
        }

        public enum ExtraOperations : int
        {
            PS2000A_ES_OFF,
            PS2000A_WHITENOISE,
            PS2000A_PRBS // Pseudo-Random Bit Stream 
        }

        public enum SigGenTrigType : int
        {
            PS2000A_SIGGEN_RISING,
            PS2000A_SIGGEN_FALLING,
            PS2000A_SIGGEN_GATE_HIGH,
            PS2000A_SIGGEN_GATE_LOW
        }

        public enum SigGenTrigSource : int
        {
            PS2000A_SIGGEN_NONE,
            PS2000A_SIGGEN_SCOPE_TRIG,
            PS2000A_SIGGEN_AUX_IN,
            PS2000A_SIGGEN_EXT_IN,
            PS2000A_SIGGEN_SOFT_TRIG
        }
And copy and past this code into the 'Driver Imports' region

Code: Select all

        [DllImport(_DRIVER_FILENAME, EntryPoint = "ps2000aSetSigGenArbitrary")]
        public static extern Int32 SetSigGenArbitray(
            short handle,
             int offsetVoltage,
            uint pkTopk,
            uint StartDeltaPhase,
            uint StopDeltaPhase,
            uint deltaPhaseIncrement,
            uint dwellCount,
           ref short arbitaryWaveform,
            int arbitaryWaveformSize,
            SweepType sweepType,
            ExtraOperations operation,
            IndexMode indexMode,
            uint shots,
            uint sweeps,
            SigGenTrigType triggerType,
            SigGenTrigSource triggerSource,
            short extInThreshold);
Kind Regards,
Karunen

Technical Specialist
Pico Technology

andurimees
Newbie
Posts: 0
Joined: Tue Sep 23, 2014 9:20 am

AWG functions...

Post by andurimees »

ref short[] arbitaryWaveform, int arbitaryWaveformSize, SweepType sweepType, ExtraOperations operation, IndexMode indexMode, uint shots, uint sweeps, SigGenTrigType triggerType, SigGenTrigSource triggerSource, short extInThreshold);
where there is a "ref short[]" instead of a "ref short".

Declaring a

short[] waveForm = {0,1,2,3,4};

and calling the function with ....., ref waveForm, 5,... does at least not crash.
I have to check with my old scope what comes out.
Please comment in case I miss something fundamental!




The next function from page 47 in the programmers manual (SetSigGenBuiltIn) is also missing.
A bit of guesswork would indicate:

Code: Select all

        [DllImport(_DRIVER_FILENAME, EntryPoint = "ps2000aSetSigGenBuiltIn")]
        public static extern Int32 SetSigGenBuiltIn(
		    short handle,
		    int offsetVoltage,
		    uint pkToPk,
		    WaveType waveType,
		    uint startFrequency,
		    uint stopFrequency,
		    uint increment,
		    uint dwellTime,
		    SweepType sweepType,
        	uint sweeps
         );

this causes stack hiccups. Especially since the floats from the c manual are to be replaced somehow.
Maybe there is a specific type for the frequency settings? :o

Could you send me the correct DLL calls?


Yours
Harald
-->
Thanks for the fast reply.
It did not work out perfectly, but the version I managed to execute is:

Code: Select all

[DllImport(_DRIVER_FILENAME, EntryPoint = "ps2000aSetSigGenArbitrary")]
        public static extern Int32 SetSigGenArbitrary(
            short handle,
             int offsetVoltage,
            uint pkTopk,
            uint StartDeltaPhase,
            uint StopDeltaPhase,
            uint deltaPhaseIncrement,
            uint dwellCount,
 --->      ref short[] arbitaryWaveform,
            int arbitaryWaveformSize,
            SweepType sweepType,
            ExtraOperations operation,
            IndexMode indexMode,
            uint shots,
            uint sweeps,
            SigGenTrigType triggerType,
            SigGenTrigSource triggerSource,
            short extInThreshold);
where there is a "ref short[]" instead of a "ref short".

Declaring a

short[] waveForm = {0,1,2,3,4};

and calling the function with ....., ref waveForm, 5,... does at least not crash.
I have to check with my old scope what comes out.
Please comment in case I miss something fundamental!




The next function from page 47 in the programmers manual (SetSigGenBuiltIn) is also missing.
A bit of guesswork would indicate:

Code: Select all

        [DllImport(_DRIVER_FILENAME, EntryPoint = "ps2000aSetSigGenBuiltIn")]
        public static extern Int32 SetSigGenBuiltIn(
		    short handle,
		    int offsetVoltage,
		    uint pkToPk,
		    WaveType waveType,
		    uint startFrequency,
		    uint stopFrequency,
		    uint increment,
		    uint dwellTime,
		    SweepType sweepType,
        	uint sweeps
         );

this causes stack hiccups. Especially since the floats from the c manual are to be replaced somehow.
Maybe there is a specific type for the frequency settings? :o

Could you send me the correct DLL calls?


Yours
Harald