siggen — signal generator
loadrt siggen [num_chan=num | names=name1[,name2…]]
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.
The names for pins, parameters, and functions are prefixed as:
siggen.N. for N=0,1,…,num=nn 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.
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.
siggen.N.frequency float in
The output frequency for signal generator N, in Hertz. The default value is 1.0 Hertz.
siggen.N.amplitude float in
The output amplitude for signal generator N. If offset is zero, the outputs will swing from -amplitude to +amplitude.
The default value is 1.00.
siggen.N.offset float in
The output offset for signal generator N.
This value is added directly to the output signal.
The default value is zero.
siggen.N.clock bit out
The clock output.
Bit type clock signal output at the commanded frequency.
siggen.N.square float out
The square wave output.
Positive while triangle and cosine are ramping upwards, and while sine is negative.
siggen.N.sine float out
The sine output.
Lags cosine by 90 degrees.
siggen.N.cosine float out
The cosine output.
Leads sine by 90 degrees.
siggen.N.triangle float out
The triangle wave output.
Ramps up while square is positive, and down while square is negative.
Reaches its positive and negative peaks at the same time as cosine.
siggen.N.sawtooth float 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 triangle and cosine are at their positive peaks, and coincides with the falling edge of square.