Component: Waveform Generator (DSP)

From Flowcode Help
Revision as of 10:35, 17 November 2021 by Wiki bot (talk | contribs)
Jump to navigationJump to search
Author Matrix Ltd
Version 1.2
Category DSP


Waveform Generator component

A waveform generator component designed to plug into the DSP system component and allow several discreet waveforms to be generated. Functions available include: Sine, Cosine, Square, Pulse, Triangle, Sawtooth, Noise, Custom

Detailed description

No detailed description exists yet for this component

Examples

Basic Sine Wave Generator

FC6 Icon.png FreqGen The frequency is controlled by adjusting the potentiometer on the panel.

FreqGen.jpg


The frequency generator period is controlled using the Period Offset property and/or the SetOffset component macro. The Offset value is the LUT index multiplier so a offset of 3.0 will only read every 3 values of the waveform to provide 1/3 of the period and generate 3 x the frequency. As the waveform period is being reduced there is potential for the signal to start to become less defined and more stepped.


Multi Wave Signal Generator

Switch-able mode frequency generator example file generating different waveforms depending on the value on pins RB0 and RB1.

0 = Sine, 1 = Square, 2 = Triangle, 3 = SawTooth

FC6 Icon.png FreqGenMulti

The frequency is controlled by adjusting the potentiometer on the panel, the waveform is controlled by adjusting the switches on the panel.

FreqGenMulti.jpg

Downloadable macro reference

Fc9-comp-macro.png Generate
Assigns a single value to the specified buffer from the selected waveform data. Each call will read the next value from the waveform and will wrap correctly at the end of the data period. 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png ModifyPhaseOffset
Shifts the output phase by the specified absolute angle in degrees. 
[[File:]] - PhaseOffset
Phase offset in degrees 
[[File:]] - Absolute
0=Relative offset to current o/p 1=Absolute offset to initial o/p 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png GenerateArray
Fills the output buffer with the selected waveform data. If the buffer is smaller or larger then the waveform data period then the data passed will follow on correctly for subsequent cycles. 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png ModifyFrequency
Sets the frequency output rate by altering the period offset to a new value. 
[[File:]] - OffsetRate
0.2=F/5 0.5=F/2 1.0=F 1.5=F*1.5 2.0=F*2 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png SetOffset
 
Fc9-u16-icon.png - UINT Offset
 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png GetOffset
 
Fc9-u16-icon.png - UINT Return


Fc9-comp-macro.png ReceiveString
Gets a string from the receive buffer 
Fc9-u16-icon.png - UINT MaxChars
 
Fc9-u16-icon.png - UINT Timeout
Time in milliseconds to wait for data 
Fc9-string-icon.png - STRING Return


Fc9-comp-macro.png Initialise
Initialises the UART component pins ready to send and receive data 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png ReceiveString
Receives a string of bytes and returns the number of bytes received. 
Fc9-string-icon.png - STRING StringData
 
Fc9-u16-icon.png - UINT NumBytes
Maximum number of bytes to try and receive 
Fc9-u16-icon.png - UINT Timeout
Max amount of time in ms to wait between bytes 
Fc9-u8-icon.png - BYTE Return


Fc9-comp-macro.png Start
Startup routine required by the hardware device. Automatically clears the display after initialising. 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png SetLEDState
Sets the state of a single LED 
Fc9-u8-icon.png - BYTE Port
0 = PortA, 1 = PortB 
Fc9-u8-icon.png - BYTE LED
0 = LED0, 7 = LED7 
Fc9-u8-icon.png - BYTE State
 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png GetRxIdent
Gets the Rx ID as a Integer Standard and Extended IDs. 
Fc9-u8-icon.png - BYTE Buffer
 
Fc9-u32-icon.png - ULONG Return


Fc9-comp-macro.png Initialise
Must be called before any other CAN component macros to enable and initialise the CAN peripheral.  
Fc9-void-icon.png - VOID Return



Property reference

Fc9-prop-icon.png Properties
Fc9-type-21-icon.png Buffer Size
Number of individual elements the buffer can store, default 1. 
Fc9-type-16-icon.png Buffer Type
Sets the buffer data type. 
Fc9-type-16-icon.png Type
Waveform type selection 
Fc9-type-14-icon.png Amplitude
Waveform amplitude or volume 
Fc9-type-14-icon.png Offset
Waveform DC offset 
Fc9-type-7-icon.png Calculate Data
Yes = Allows Sine and Cosine data to be generated using a mathmatical floating point calculation, provides much better resolution at the cost of processing performance. No = Allows Sine and Cosine data to be generated ahead of run time, provides fixed resolution output but is fast and efficient to generate. 
Fc9-type-14-icon.png Samples
Waveform sample count, the number of data points in the stored cyclic wave look up table. 
Fc9-type-16-icon.png Start Phase Angle
Waveform phase, the angle in degrees or sample in the wave to start streaming from 
Fc9-type-10-icon.png Data
The raw waveform data 
Fc9-type-15-icon.png Period Offset
The initial amount that the index increments through the LUT data when reading the stored waveform. 0.2 = Frequency / 5 0.5 = Frequency / 2 1.0 = Original Frequency 1.5 = Frequency * 1.5 2.0 = Frequency * 2 
Fc9-type-15-icon.png Sample Period
Degrees per default sample offset period 
Fc9-type-15-icon.png Sample Rate (hz)
Allows the sample rate to be entered to allow some basic calculations 
Fc9-type-15-icon.png Period (s)
The length of time in seconds that the wave period will cover at the specified sample rate 
Fc9-type-15-icon.png Frequency (hz)
The repeat frequency of the wave at the specified sample rate 
Fc9-conn-icon.png Connections
Fc9-conn-icon.png Simulations