I am writing a Matlab-program to measure with the pico 4227. At the moment i try to understand the signal generator and got it working with the api-function and this code
- Code: Select all
[Status] = calllib('ps4000','ps4000SetSigGenBuiltIn',UnitHandle, SigGen.offsetVoltage, SigGen.pkToPk, SigGen.waveType, SigGen.startFrequency, SigGen.stopFrequency, SigGen.increment, SigGen.dwellTime, SigGen.sweepType, SigGen.whiteNoise, SigGen.shots, SigGen.sweeps, SigGen.triggerType, SigGen.triggerSource, SigGen.extInThreshold);
where SigGen holds all the numbers to set the signal generator up.
The problem is, that the measured frequency does not correlate to the frequency i set.
I set 100 Hz for example and measured 42, 80 and 60 Hz. I dont understand this!?!?!
Here are my settings
- Code: Select all
%SigGen offset Voltage in muV
%Peak to peak voltage in muV
SigGen.pkToPk=uint32(600000); %>=500mV and <=4V
%Signal type, please select from table below. Don't forget the single
%Table of possible built-in waveforms
%'PS4000_SINE' sine wave
%'PS4000_SQUARE' square wave
%'PS4000_TRIANGLE' triangle wave
%'PS4000_RAMP_UP' rising sawtooth
%'PS4000_RAMP_DOWN' falling sawtooth
%'PS4000_DC_VOLTAGE' DC voltage
%Start/stop frequency (picoscope sweeps from start to stop frequency if they are
SigGen.startFrequency=single(100); %needs to be >=0 and <= 2 000 000
SigGen.stopFrequency=single(100); %needs to be >=0 and <= 2 000 000
SigGen.increment=single(0); %increment of sweep
SigGen.dwellTime=single(0); %time between every increment
SigGen.sweepType='DOWN'; %sweep 'direction', pls select from table below
%table of possible sweepTypes
%if whiteNoise is set to 1 all settings except offsetVoltage and pkToPk
%will be ignored
SigGen.whiteNoise=int16(0); % either 0 or 1
%number of waveforms to be produced after trigger event
SigGen.shots=uint32(1); %needs to be >=0 and <=???
%number of sweeps to be produced after trigger event, if this is set to non-zero, shots must be set to
SigGen.sweeps=uint32(0); %needs to be >=0 and <=???
%trigger type to trigger the signal generator
SigGen.triggerType='SIGGEN_RISING'; %pls select from table below
%Table of signal generator trigger type
%'SIGGEN_GATE_HIGH' %not supported yet because SIGGEN_SOFT_TRIG not used
%'SIGGEN_GATE_LOW' %not supported yet --"--
%Table of signal generator trigger sources
%'SIGGEN_NONE' %if other than this is set either shots or sweeps must be
%set to non-zero
%'SIGGEN_SOFT_TRIG' %not used but wiht the lib-function
%ps4000SigGenSoftwareControl than with SIGGEN_GATE_HIGH/LOW signal
%generator can be triggerd
%if ExtIn is set for trigger source this sets the trigger level
SigGen.extInThreshold=int16(0); %in adc counts
I need more information, the manual doesnt say anything to the units. In what unit shall i input the startFrequency and stopFrequency.
Why do i measure more than one shot? i set shots=1 and the SigGen sends infinitly many shots.
What is about the triggering?
I set SIGGEN_SCOPE_TRIG and i thought (because there is no signal on the scope) the trigger signal would never be send, but the SigGen starts. Why?
Then I thought the trigger Signal would be send 1 time because of the autotrigger-signal what is send after 10ms in my case.
Why does this SOFT_TRIG not work? The function I need is not in the library (header-file). How do I set the Gate high or low?
Thanks for any answers