API Functions
52Copyright © 2006–2022 Pico Technology Ltd. All rights reserved.ps2000pg.en-12
PicoScope 2000 Series Programmer's Guide
5.29 ps2000_set_sig_gen_arbitrary
int16_t ps2000_set_sig_gen_arbitrary
(
int16_t handle,
int32_t offsetVoltage,
uint32_t pkToPk,
uint32_t startDeltaPhase,
uint32_t stopDeltaPhase,
uint32_t deltaPhaseIncrement,
uint32_t dwellCount,
uint8_t *arbitraryWaveform,
int32_t arbitraryWaveformSize,
PS2000_SWEEP_TYPE sweepType,
uint32_t sweeps
)
This function programs the signal generator to produce an arbitrary waveform.
The arbitrary waveform generator uses direct digital synthesis (DDS). It maintains a 32-bit
phase accumulator that indicates the present location in the waveform. The top bits of the
phase accumulator are used as an index into a buffer containing the arbitrary waveform. The
remaining bits act as the fractional part of the index, enabling high-resolution control of output
frequency and allowing the generation of lower frequencies.
The generator steps through the waveform by adding a deltaPhase value between 1 and
phaseAccumulatorSize-1 to the phase accumulator every ddsPeriod (1 / ddsFrequency). If the
deltaPhase is constant, the generator produces a waveform at a constant frequency that can
be calculated as follows:
(
) ( )
outputFrequency =
ddsFrequency ×
deltaPhase
phaseAccumulatorSize
×
awgBufferSize
arbitraryWaveformSize
where:
outputFrequency = repetition rate of the complete arbitrary waveform
ddsFrequency = clock rate of phase accumulator (not the same as the DAC
update rate)
deltaPhase = user-specified delta phase value
phaseAccumulatorSize = 2
32
for all models
awgBufferSize = AWG buffer size
arbitraryWaveformSize = length in samples of the user-defined waveform
ddsPeriod (= 1/ddsFrequency)
It is also possible to sweep the frequency by continually modifying the deltaPhase. This is done
by setting up a deltaPhaseIncrement that the oscilloscope adds to the deltaPhase at
intervals specified by dwellCount.