Difference between revisions of "DSP"

From Flowcode Help
Jump to navigationJump to search
Line 61: Line 61:
  
 
==DSP Components==
 
==DSP Components==
 +
 +
More detailed explanations, examples and help can be found for each of the DSP components by following the links provided below.
 +
  
 
===Input===
 
===Input===
Line 97: Line 100:
  
 
The [[Component:_ID_32b9bbd2_acfa_4404_835b_72ee08d07a6a|DSP FFT]] component is used to convert a time based signal into a frequency based spectrum by dishing out the frequencies present in the buffer into a number of frequency bins.
 
The [[Component:_ID_32b9bbd2_acfa_4404_835b_72ee08d07a6a|DSP FFT]] component is used to convert a time based signal into a frequency based spectrum by dishing out the frequencies present in the buffer into a number of frequency bins.
 
  
 
==Buffer vs Tick==
 
==Buffer vs Tick==
  
 
Most of the DSP components have built in macros in the form of
 
Most of the DSP components have built in macros in the form of

Revision as of 17:13, 5 March 2014

What is DSP

DSP or Digital Signal Processing is a way of processing data in way that provides some kind of additional functionality. DSP usually takes the form of an input, a process on the input and an output corresponding to the process. As microcontrollers are generally quite fast devices it is the act of repeating the process at high speed that allows us to perform the task in hand.


These are all potential examples of a DSP system at work:

Guitar Distortion

Audio effects e.g. Echo, Reverb, etc.

Digital Filtering

Frequency Spectrum Analysis

Baby Monitors

Covert Listening Devices (Bugs)

Speed Control

Position Control

Temperature Control


The DSP System Component

There are a number of components built into Flowcode to help you to create a DSP system specific for what you need.


The DSP components all centre around the DSP System component which is basically the buffer manager for the system. For each link between components we need a buffer, think of each buffer as a pipe that the data can flow along. The size of each buffer dictates the number of operations or "ticks" that have to happen before the data reaches the end of the buffer. If we know the "tick" rate of the system and the size of the buffer then we know the delay that will be presented when the data is travelling through the buffer.


For example if we have an input component connected directly to an output component then we need only one buffer.

DSP1.jpg


If we have two input components connected via a sum component and then onto an output component then we need three buffers. Naming the buffers can help when it comes to connecting everything up.

DSP3.jpg


By default all the buffers have the same bit depth and sign but by disabling the simple mode property these can be manually edited for each individual buffer.

DSP4.jpg


Components are connected up to the buffers by specifying the buffer manager and then selecting the buffer. The arrows automatically connect themselves up as you set the connection properties and move the component around on the panel.

DSP2.jpg


The DSP system initialise function must be called in your program before any other DSP component macros are called as it sets up the buffers ready to be used. The initialise function also sets up the scope window so if you like you can see the DSP signals during simulation to help debug or visualise what's going on.

DSP5.jpg


DSP Components

More detailed explanations, examples and help can be found for each of the DSP components by following the links provided below.


Input

The DSP Input component is used to pass data from another source into the DSP system. This data could come from an analogue source, a external sensor on an SPI or I2C bus, a data file, the possibilities are endless.

Output

The DSP Output component is used to pass data to another source from the DSP system. This data could go to an digital to analogue converter, a external device on an SPI or I2C bus, a data file, the possibilities are endless.

Frequency Generator

The DSP Frequency Generator component is used to pass fixed waveform data into the DSP system. This data is generated by the component depending on the component's various properties. The waveform data is stored into ROM in the embedded target to allow the RAM memory to be retained for the DSP buffers and other system variables.

Delay

The DSP Delay component is used to create an additional buffered delay. Useful for a wide variety of task such as filtering, phase synchronising, echo effects etc.

Scale

The DSP Scale component is used to alter the data in a buffer by allowing a scale or offset to be applied.

Level

The DSP Level component is used to detect peaks, troughs and averages in the data contained in a buffer. This comes with a decay property which allows you to maintain record values long after they have left the contents of the buffer.

Sum

The DSP Sum component is used to allow two buffers to be merged into one using several different techniques such as addition, subtraction, take the max, take the min etc.

Filter

The DSP Filter component is used to attenuate unwanted frequencies from the data in a buffer leaving the buffer full of only the frequencies we are interested in.

FFT

The DSP FFT component is used to convert a time based signal into a frequency based spectrum by dishing out the frequencies present in the buffer into a number of frequency bins.

Buffer vs Tick

Most of the DSP components have built in macros in the form of