siggen9
Signal generator
Usage
loadrt siggen [num_chan=num | names=name1[,name2...]]
Overview
siggen is a signal generator that can be used for testing and other applications that need simple waveforms. It produces sine, cosine, triangle, sawtooth, and square waves of variable frequency, amplitude, and offset, which can be used as inputs to other HAL components.
siggen supports a maximum of sixteen channels. The number of channels actually loaded is set by the num_chan argument when the module is loaded. Alternatively, specify names= and unique names separated by commas.
The num_chan= and names= specifiers are mutually exclusive. If neither num_chan= nor names= are specified, the default value is one.
Naming
The names for pins, parameters, and functions are prefixed as:
siggen.N. for N=0,1,...,num-1 when using num_chan=num
nameN. for nameN=name1,name2,... when using names=name1,name2,...
The siggen.N. format is shown in the following descriptions.
Functions
siggen.N.update(uses floating-point)-
Updates output pins for signal generator N. Each time it is called it calculates a new sample. It should be called many times faster than the desired signal frequency, to avoid distortion and aliasing.
Pins
siggen.N.frequencyfloat in-
The output frequency for signal generator N, in Hertz. The default value is 1.0 Hertz.
siggen.N.amplitudefloat in-
The output amplitude for signal generator N. If
offsetis zero, the outputs will swing from -amplitudeto +amplitude. The default value is 1.00.
siggen.N.offsetfloat in-
The output offset for signal generator N. This value is added directly to the output signal. The default value is zero.
siggen.N.resetbit in-
Resets output pins to pretermined states:
sine 0
sawtooth 0
square -1 * amplitude
cosine -1 * amplitude
triangle -1 * amplitude
siggen.N.clockbit out-
The clock output. Bit type clock signal output at the commanded frequency.
siggen.N.squarefloat out-
The square wave output. Positive while
triangleandcosineare ramping upwards, and whilesineis negative.
siggen.N.sinefloat out-
The sine output. Lags
cosineby 90 degrees.
siggen.N.cosinefloat out-
The cosine output. Leads
sineby 90 degrees.
siggen.N.trianglefloat out-
The triangle wave output. Ramps up while
squareis positive, and down whilesquareis negative. Reaches its positive and negative peaks at the same time ascosine.
siggen.N.sawtoothfloat out-
The sawtooth output. Ramps upwards to its positive peak, then instantly drops to its negative peak and starts ramping again. The drop occurs when
triangleandcosineare at their positive peaks, and coincides with the falling edge ofsquare.
Parameters
None
Releases
Unchanged in 2 releases since Debian 12 (Bookworm).