(solved) [Delphi] PS2000 Series Signal Generator

Post general discussions on using our drivers to write your own software here
Post Reply
nuclearping

(solved) [Delphi] PS2000 Series Signal Generator

Post by nuclearping »

Hey there,

sorry for posting here but unfortunately there is no Delphi subforum.

We're using a PS2000 device and want to utilize the built in signal generator to generate hearable frequencies.

It works so far but unfortunately I do not get the same results as from the PicoScope software signal generator.

I declared the ps2000_set_sig_gen_built_in function as follows

Code: Select all

function ps2000_set_sig_gen_built_in
         (handle : smallint;
          offsetVoltage : integer;
          pkToPk : cardinal;
          waveType : smallint;
          startFrequency : double;
          stopFrequency : double;
          increment : double;
          dwellTime : double;
          sweepType : smallint;
          sweeps : cardinal)
          : smallint;
{$IFDEF WIN32} stdcall; external 'ps2000.dll';{$ENDIF}
and call it like this

Code: Select all

ps2000handle := ps2000_open_unit();
r := ps2000_set_sig_gen_built_in(
    ps2000_handle, 
    0 {No offset},
    1000000 {1V},
    PS2000_SINE, 
    200 {StartFreq}, 
    200 {EndFreq}, 
    0, 0, PS2000_UP, 0 {We want no sweeping});
The return value of ps2000_set_sig_gen_built_in is 1 and I hear sound from the connected headphones. But ... When I set the same values in the PicoScope software sig gen I hear a constant 200Hz sound, as it should be. Also the sound is very loud and powerfull.

Using my test software I hear a little almost silent sweeping sound which vibrates quite fast, allthough start and end frequencies are the same.

Even if I change some values the vibrating sound remains the same. Only when I increase or decrease the voltage the sound volume changes or when I change the start frequency the heard tone changes too. But when I change the end frequency nothing changes.

It is like there is a constant sweeping active allthough it shouldn't be because the parameters shouldn't allow it.

I took a look with a friend today for about a hour and we were unable to figure it out. :/

Anybody an idea how to solve the above problems so the generated tones from my software are equal to the tones coming from the PicoScope software's sig gen?

Thanks alot!
Last edited by nuclearping on Thu Mar 03, 2011 10:09 am, edited 1 time in total.

svebert

Re: [Delphi] PS2000 Series Signal Generator

Post by svebert »

I have also major problems with the api-functions of the generator (but ps4227).
For the built-in waveforms like sine, the generator produces a sine but with a frequency which does not correlate to the value i set for startfrequency=stopfrequency. For every call of the function i get different frequencies, but i am not changing the frequency!! Its really weird.

The arbitrary-waveform generator is also ununderstandable. I can't set the offset voltage and i don't understand the relation between the deltaphase and the actual frequency. Too less information in the manual...

These problems I already stated in another thread in this forum.

nuclearping

Re: [Delphi] PS2000 Series Signal Generator

Post by nuclearping »

Ok, good to see I'm not alone, although it doesn't help us much. :D

But yes, the programmer's manual is really crappy at some points. :(

nuclearping

Re: (solved) [Delphi] PS2000 Series Signal Generator

Post by nuclearping »

Ok, here it was a declaration data type error too.

Code: Select all

function ps2000_set_sig_gen_built_in
         (handle : smallint;
          offsetVoltage : longint;
          pkToPk : longword;
          waveType : integer;
          startFrequency : single;
          stopFrequency : single;
          increment : single;
          dwellTime : single;
          sweepType : integer;
          sweeps : longword)
          : smallint;
{$IFDEF WIN32} stdcall; external 'ps2000.dll';{$ENDIF}
Thats the correct declaration and the signal generator now works as expected.

:D :D :D

svebert

Re: (solved) [Delphi] PS2000 Series Signal Generator

Post by svebert »

Very good!
I am using Matlab and did define also singles as you did now.

The offsetVoltage-problem is solved: If you measure the AWG-signal with a different oscilloscope, then you can measure the offset you set.
I measured always with the PS4227 itself and then the offsetvoltage dissapears somehow...
So the Built-in-waveform-Signal-Generator is working fine :-)

But I have still problems with the arbitrary-waveform generator.

Here the manual says i have to define ulongs/ (uint32 for Matlab) for the deltaphase.
I dont understand this deltaphase-stuff...

I understood this:
Every 50ns the generator steps through the waveform buffer. If the startindex si=1 then after 50ns the current index cs=si+deltaphase. Is this right???

If my buffer contains 1000 sample points and delta=1 then the generator should produce a signal with a period of 1000*50ns.
If deltaphase=100 then the period should be 1000*50ns/100 and so on. Is this right?

Obvisously i am wrong because when I set deltaphase=10, i measure a signal with 0,382Hz instead of 10/(1000*50ns)=200kHz.

Also why can i set deltaphase greater than the buffersize? What should this be good for?

Thank you for any advises
Sven

Post Reply