Difference between revisions of "Component: Waveform Generator (DSP Inputs)"

From Flowcode Help
Jump to navigationJump to search
 
(6 intermediate revisions by the same user not shown)
Line 22: Line 22:
  
 
==Detailed description==
 
==Detailed description==
 +
 +
  
  
Line 46: Line 48:
  
 
==Examples==
 
==Examples==
 +
 +
  
  
Line 90: Line 94:
 
[[File:FreqGenMulti.jpg]]
 
[[File:FreqGenMulti.jpg]]
  
==Macro reference==
 
  
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Generate'''
 
|-
 
| colspan="2" | 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. 
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
  
  
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ModifyPhaseOffset'''
 
|-
 
| colspan="2" | Shifts the output phase by the specified absolute angle in degrees. 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-f32-icon.png]] - FLOAT
 
| width="90%" | PhaseOffset
 
|-
 
| colspan="2" | Phase offset in degrees 
 
|-
 
| width="10%" align="center" | [[File:Fc9-bool-icon.png]] - BOOL
 
| width="90%" | Absolute
 
|-
 
| colspan="2" | 0=Relative offset to current o/p 1=Absolute offset to initial o/p 
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GenerateArray'''
 
|-
 
| colspan="2" | 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. 
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
  
  
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ModifyFrequency'''
 
|-
 
| colspan="2" | Sets the frequency output rate by altering the period offset to a new value. 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-f32-icon.png]] - FLOAT
 
| width="90%" | OffsetRate
 
|-
 
| colspan="2" | 0.2=F/5  0.5=F/2  1.0=F  1.5=F*1.5  2.0=F*2 
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
  
  
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetOffset'''
 
|-
 
| colspan="2" |  
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" | Offset
 
|-
 
| colspan="2" |  
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
  
  
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetOffset'''
 
|-
 
| colspan="2" |  
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
  
  
  
  
==Property reference==
 
  
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
+
==Macro reference==
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
 
| width="90%" | Buffer Size
 
|-
 
| colspan="2" | Number of individual elements the buffer can store, default 1. 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
| width="90%" | Buffer Type
 
|-
 
| colspan="2" | Sets the buffer data type. 
 
|-
 
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
 
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Waveform
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
| width="90%" | Type
 
|-
 
| colspan="2" | Waveform type selection 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
 
| width="90%" | Amplitude
 
|-
 
| colspan="2" | Waveform amplitude or volume 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
 
| width="90%" | Offset
 
|-
 
| colspan="2" | Waveform DC offset 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
 
| width="90%" | Calculate Data
 
|-
 
| colspan="2" | 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. 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
 
| width="90%" | Samples
 
|-
 
| colspan="2" | Waveform sample count, the number of data points in the stored cyclic wave look up table. 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
| width="90%" | Start Phase Angle
 
|-
 
| colspan="2" | Waveform phase, the angle in degrees or sample in the wave to start streaming from 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-10-icon.png]]
 
| width="90%" | Data
 
|-
 
| colspan="2" | The raw waveform data 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-15-icon.png]]
 
| width="90%" | Period Offset
 
|-
 
| colspan="2" | 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 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-15-icon.png]]
 
| width="90%" | Sample Period
 
|-
 
| colspan="2" | Degrees per default sample offset period 
 
|-
 
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
 
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Frequency Calculation
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-15-icon.png]]
 
| width="90%" | Sample Rate (hz)
 
|-
 
| colspan="2" | Allows the sample rate to be entered to allow some basic calculations 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-15-icon.png]]
 
| width="90%" | Period (s)
 
|-
 
| colspan="2" | The length of time in seconds that the wave period will cover at the specified sample rate 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-15-icon.png]]
 
| width="90%" | Frequency (hz)
 
|-
 
| colspan="2" | The repeat frequency of the wave at the specified sample rate 
 
|}==Macro reference==
 
  
 +
===Generate===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
Line 292: Line 124:
  
  
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
+
===GenerateArray===
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ModifyPhaseOffset'''
 
|-
 
| colspan="2" | Shifts the output phase by the specified absolute angle in degrees. 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-f32-icon.png]] - FLOAT
 
| width="90%" | PhaseOffset
 
|-
 
| colspan="2" | Phase offset in degrees 
 
|-
 
| width="10%" align="center" | [[File:Fc9-bool-icon.png]] - BOOL
 
| width="90%" | Absolute
 
|-
 
| colspan="2" | 0=Relative offset to current o/p 1=Absolute offset to initial o/p 
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
Line 328: Line 138:
  
  
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
+
===GetOffset===
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ModifyFrequency'''
 
|-
 
| colspan="2" | Sets the frequency output rate by altering the period offset to a new value. 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-f32-icon.png]] - FLOAT
 
| width="90%" | OffsetRate
 
|-
 
| colspan="2" | 0.2=F/5  0.5=F/2  1.0=F  1.5=F*1.5  2.0=F*2 
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetOffset'''
 
|-
 
| colspan="2" |  
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" | Offset
 
|-
 
| colspan="2" |  
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
Line 369: Line 144:
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetOffset'''
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetOffset'''
 
|-
 
|-
| colspan="2" |  
+
| colspan="2" | Gets the current phase of the wave as an index from 0 to Num Samples. 
 
|-
 
|-
 
|-
 
|-
Line 377: Line 152:
  
  
 
+
===ModifyFrequency===
 
 
==Property reference==
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
 
| width="90%" | Buffer Size
 
|-
 
| colspan="2" | Number of individual elements the buffer can store, default 1. 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
| width="90%" | Buffer Type
 
|-
 
| colspan="2" | Sets the buffer data type. 
 
|-
 
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
 
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Waveform
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
| width="90%" | Type
 
|-
 
| colspan="2" | Waveform type selection 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
 
| width="90%" | Amplitude
 
|-
 
| colspan="2" | Waveform amplitude or volume 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
 
| width="90%" | Offset
 
|-
 
| colspan="2" | Waveform DC offset 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
 
| width="90%" | Calculate Data
 
|-
 
| colspan="2" | 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. 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
 
| width="90%" | Samples
 
|-
 
| colspan="2" | Waveform sample count, the number of data points in the stored cyclic wave look up table. 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
| width="90%" | Start Phase Angle
 
|-
 
| colspan="2" | Waveform phase, the angle in degrees or sample in the wave to start streaming from 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-10-icon.png]]
 
| width="90%" | Data
 
|-
 
| colspan="2" | The raw waveform data 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-15-icon.png]]
 
| width="90%" | Period Offset
 
|-
 
| colspan="2" | 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 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-15-icon.png]]
 
| width="90%" | Sample Period
 
|-
 
| colspan="2" | Degrees per default sample offset period 
 
|-
 
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
 
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Frequency Calculation
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-15-icon.png]]
 
| width="90%" | Sample Rate (hz)
 
|-
 
| colspan="2" | Allows the sample rate to be entered to allow some basic calculations 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-15-icon.png]]
 
| width="90%" | Period (s)
 
|-
 
| colspan="2" | The length of time in seconds that the wave period will cover at the specified sample rate 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-15-icon.png]]
 
| width="90%" | Frequency (hz)
 
|-
 
| colspan="2" | The repeat frequency of the wave at the specified sample rate 
 
|}==Macro reference==
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Generate'''
 
|-
 
| colspan="2" | 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. 
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ModifyPhaseOffset'''
 
|-
 
| colspan="2" | Shifts the output phase by the specified absolute angle in degrees. 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-f32-icon.png]] - FLOAT
 
| width="90%" | PhaseOffset
 
|-
 
| colspan="2" | Phase offset in degrees 
 
|-
 
| width="10%" align="center" | [[File:Fc9-bool-icon.png]] - BOOL
 
| width="90%" | Absolute
 
|-
 
| colspan="2" | 0=Relative offset to current o/p 1=Absolute offset to initial o/p 
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GenerateArray'''
 
|-
 
| colspan="2" | 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. 
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
Line 533: Line 171:
  
  
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
+
===ModifyPhaseOffset===
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetOffset'''
 
|-
 
| colspan="2" |  
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" | Offset
 
|-
 
| colspan="2" |  
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetOffset'''
 
|-
 
| colspan="2" |  
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
 
 
 
 
==Property reference==
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
 
| width="90%" | Buffer Size
 
|-
 
| colspan="2" | Number of individual elements the buffer can store, default 1. 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
| width="90%" | Buffer Type
 
|-
 
| colspan="2" | Sets the buffer data type. 
 
|-
 
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
 
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Waveform
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
| width="90%" | Type
 
|-
 
| colspan="2" | Waveform type selection 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
 
| width="90%" | Amplitude
 
|-
 
| colspan="2" | Waveform amplitude or volume 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
 
| width="90%" | Offset
 
|-
 
| colspan="2" | Waveform DC offset 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
 
| width="90%" | Calculate Data
 
|-
 
| colspan="2" | 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. 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
 
| width="90%" | Samples
 
|-
 
| colspan="2" | Waveform sample count, the number of data points in the stored cyclic wave look up table. 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
| width="90%" | Start Phase Angle
 
|-
 
| colspan="2" | Waveform phase, the angle in degrees or sample in the wave to start streaming from 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-10-icon.png]]
 
| width="90%" | Data
 
|-
 
| colspan="2" | The raw waveform data 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-15-icon.png]]
 
| width="90%" | Period Offset
 
|-
 
| colspan="2" | 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 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-15-icon.png]]
 
| width="90%" | Sample Period
 
|-
 
| colspan="2" | Degrees per default sample offset period 
 
|-
 
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
 
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Frequency Calculation
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-15-icon.png]]
 
| width="90%" | Sample Rate (hz)
 
|-
 
| colspan="2" | Allows the sample rate to be entered to allow some basic calculations 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-15-icon.png]]
 
| width="90%" | Period (s)
 
|-
 
| colspan="2" | The length of time in seconds that the wave period will cover at the specified sample rate 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-15-icon.png]]
 
| width="90%" | Frequency (hz)
 
|-
 
| colspan="2" | The repeat frequency of the wave at the specified sample rate 
 
|}==Macro reference==
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Generate'''
 
|-
 
| colspan="2" | 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. 
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
Line 689: Line 195:
  
  
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
+
===SetOffset===
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GenerateArray'''
 
|-
 
| colspan="2" | 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. 
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ModifyFrequency'''
 
|-
 
| colspan="2" | Sets the frequency output rate by altering the period offset to a new value. 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-f32-icon.png]] - FLOAT
 
| width="90%" | OffsetRate
 
|-
 
| colspan="2" | 0.2=F/5  0.5=F/2  1.0=F  1.5=F*1.5  2.0=F*2 
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
Line 725: Line 201:
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetOffset'''
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetOffset'''
 
|-
 
|-
| colspan="2" |  
+
| colspan="2" | Sets the current phase of the wave as an index from 0 to Num Samples. 
 
|-
 
|-
 
|-
 
|-
Line 731: Line 207:
 
| width="90%" | Offset
 
| width="90%" | Offset
 
|-
 
|-
| colspan="2" |  
+
| colspan="2" | Offset Index: 0 to Num Samples -1 
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
|}
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetOffset'''
 
|-
 
| colspan="2" |  
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
  
  
Line 793: Line 254:
 
| width="90%" | Calculate Data
 
| width="90%" | Calculate Data
 
|-
 
|-
| colspan="2" | 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. 
+
| colspan="2" | Yes = Allows Sine, Cosine, Noise data to be generated on the fly using a calculation, provides much better resolution at the cost of processing performance. No = Allows Sine, Cosine, Noise data to be generated ahead of run time, provides fixed resolution output but is fast and efficient to generate. 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
 
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
Line 821: Line 282:
 
|-
 
|-
 
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
 
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Frequency Calculation
+
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Frequency Calculation - Reference Only
 
|-
 
|-
 
|-
 
|-

Latest revision as of 11:31, 23 October 2023

Author Matrix Ltd
Version 1.2
Category DSP Inputs


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

Component Source Code

Please click here to download the component source project: FC_Comp_Source_DSP_Wave_Gen.fcfx

Please click here to view the component source code (Beta): FC_Comp_Source_DSP_Wave_Gen.fcfx

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








Macro reference

Generate

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


GenerateArray

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


GetOffset

Fc9-comp-macro.png GetOffset
Gets the current phase of the wave as an index from 0 to Num Samples. 
Fc9-u16-icon.png - UINT Return


ModifyFrequency

Fc9-comp-macro.png ModifyFrequency
Sets the frequency output rate by altering the period offset to a new value. 
Fc9-f32-icon.png - FLOAT 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


ModifyPhaseOffset

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


SetOffset

Fc9-comp-macro.png SetOffset
Sets the current phase of the wave as an index from 0 to Num Samples. 
Fc9-u16-icon.png - UINT Offset
Offset Index: 0 to Num Samples -1 
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-conn-icon.png Waveform
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, Cosine, Noise data to be generated on the fly using a calculation, provides much better resolution at the cost of processing performance. No = Allows Sine, Cosine, Noise 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-conn-icon.png Frequency Calculation - Reference Only
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