Difference between revisions of "Component: Frequency Generator (DSP)"
(XML import of component documentation) |
(XML import BR) |
||
(12 intermediate revisions by 4 users not shown) | |||
Line 4: | Line 4: | ||
|- | |- | ||
| width="20%" style="color: gray;" | Author | | width="20%" style="color: gray;" | Author | ||
− | | | + | | Matrix Ltd |
|- | |- | ||
| width="20%" style="color: gray;" | Version | | width="20%" style="color: gray;" | Version | ||
− | | 1.2 | + | | 1.2 (Release) |
|- | |- | ||
| width="20%" style="color: gray;" | Category | | width="20%" style="color: gray;" | Category | ||
Line 16: | Line 16: | ||
==[[File:Component Icon cbe42abc_5955_44da_a6d0_03e7cbcdcaca.png|Image]] Frequency Generator component== | ==[[File:Component Icon cbe42abc_5955_44da_a6d0_03e7cbcdcaca.png|Image]] Frequency Generator component== | ||
+ | A frequency generator component designed to plug into the DSP system component and allow several discreet waveforms to be generated. | ||
+ | Functions available include: Sine, Square, Pulse, Triangle, Sawtooth, Noise, Custom | ||
+ | ==Examples== | ||
+ | ===Basic Sine Wave Generator=== | ||
+ | {{Fcfile|FreqGen.fcfx|FreqGen}} | ||
+ | The frequency is controlled by adjusting the potentiometer on the panel. | ||
+ | |||
+ | [[File: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 | ||
+ | {{Fcfile|FreqGenMulti.fcfx|FreqGenMulti}} | ||
+ | The frequency is controlled by adjusting the potentiometer on the panel, the waveform is controlled by adjusting the switches on the panel. | ||
+ | |||
+ | [[File:FreqGenMulti.jpg]] | ||
==Downloadable macro reference== | ==Downloadable macro reference== | ||
===<span style="font-weight: normal;"><u><tt>GenerateTick</tt></u></span>=== | ===<span style="font-weight: normal;"><u><tt>GenerateTick</tt></u></span>=== | ||
− | + | 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. | |
− | |||
− | |||
'''Parameters''' | '''Parameters''' | ||
Line 40: | Line 56: | ||
===<span style="font-weight: normal;"><u><tt>Generate</tt></u></span>=== | ===<span style="font-weight: normal;"><u><tt>Generate</tt></u></span>=== | ||
− | '' | + | Fills the specified 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 subsequest cycles. |
+ | |||
+ | '''Parameters''' | ||
+ | |||
+ | :''This macro has no parameters'' | ||
+ | '''Return value''' | ||
+ | |||
+ | :''This call does not return a value'' | ||
+ | |||
+ | |||
+ | ===<span style="font-weight: normal;"><u><tt>SetOffset</tt></u></span>=== | ||
+ | Sets the period offset to a new value to alter the waveform output rate. | ||
'''Parameters''' | '''Parameters''' | ||
− | :'' | + | :[[Variable Types|FLOAT]] ''OffsetRate'' |
+ | ::0.2=F/5 0.5=F/2 1.0=F 1.5=F*1.5 2.0=F*2 | ||
Line 65: | Line 93: | ||
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''buffer_manager''. | This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''buffer_manager''. | ||
− | + | Selects the DSP buffer manager component | |
− | |||
− | |||
<span style="font-weight: normal;"><u>Output</u></span> | <span style="font-weight: normal;"><u>Output</u></span> | ||
Line 73: | Line 99: | ||
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''input_a''. | This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''input_a''. | ||
− | + | Selects the buffer to assign the waveform data to | |
− | |||
− | |||
<span style="font-weight: normal;"><u>Type</u></span> | <span style="font-weight: normal;"><u>Type</u></span> | ||
Line 81: | Line 105: | ||
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''wave_type''. | This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''wave_type''. | ||
− | + | Waveform type selection | |
− | |||
− | |||
<span style="font-weight: normal;"><u>Amplitude</u></span> | <span style="font-weight: normal;"><u>Amplitude</u></span> | ||
Line 89: | Line 111: | ||
This property is of type ''Signed integer'' and can be referenced with the variable name ''wave_amplitude''. | This property is of type ''Signed integer'' and can be referenced with the variable name ''wave_amplitude''. | ||
− | + | Waveform amplitude or volume | |
− | |||
− | |||
<span style="font-weight: normal;"><u>Offset</u></span> | <span style="font-weight: normal;"><u>Offset</u></span> | ||
Line 97: | Line 117: | ||
This property is of type ''Signed integer'' and can be referenced with the variable name ''wave_offset''. | This property is of type ''Signed integer'' and can be referenced with the variable name ''wave_offset''. | ||
− | + | Waveform DC offset | |
+ | <span style="font-weight: normal;"><u>Period</u></span> | ||
+ | This property is of type ''Signed integer'' and can be referenced with the variable name ''wave_period''. | ||
− | + | Waveform period, the number of samples in the cyclic wave | |
− | + | <span style="font-weight: normal;"><u>Phase</u></span> | |
− | '' | + | This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''wave_phase''. |
+ | Waveform phase, the point in the wave to start streaming from | ||
+ | <span style="font-weight: normal;"><u>Data</u></span> | ||
− | + | This property is of type ''Line of text'' and can be referenced with the variable name ''wave_data''. | |
− | + | The raw waveform data | |
− | + | <span style="font-weight: normal;"><u>Period Offset</u></span> | |
+ | This property is of type ''Floating point'' and can be referenced with the variable name ''PeriodOffset''. | ||
+ | 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 | ||
<span style="font-weight: normal;"><u>Sample Rate (hz)</u></span> | <span style="font-weight: normal;"><u>Sample Rate (hz)</u></span> | ||
Line 129: | Line 157: | ||
This property is of type ''Floating point'' and can be referenced with the variable name ''sample_rate''. | This property is of type ''Floating point'' and can be referenced with the variable name ''sample_rate''. | ||
− | + | Allows the sample rate to be entered to allow some basic calculations | |
− | |||
− | |||
<span style="font-weight: normal;"><u>Period (s)</u></span> | <span style="font-weight: normal;"><u>Period (s)</u></span> | ||
Line 137: | Line 163: | ||
This property is of type ''Floating point'' and can be referenced with the variable name ''calc_period''. | This property is of type ''Floating point'' and can be referenced with the variable name ''calc_period''. | ||
− | + | The length of time in seconds that the wave period will cover at the specified sample rate | |
− | |||
− | |||
<span style="font-weight: normal;"><u>Frequency (hz)</u></span> | <span style="font-weight: normal;"><u>Frequency (hz)</u></span> | ||
Line 145: | Line 169: | ||
This property is of type ''Floating point'' and can be referenced with the variable name ''calc_freq''. | This property is of type ''Floating point'' and can be referenced with the variable name ''calc_freq''. | ||
− | + | The repeat frequency of the wave at the specified sample rate |
Latest revision as of 15:45, 16 February 2017
Author | Matrix Ltd |
Version | 1.2 (Release) |
Category | DSP |
Contents
Frequency Generator component
A frequency generator component designed to plug into the DSP system component and allow several discreet waveforms to be generated. Functions available include: Sine, Square, Pulse, Triangle, Sawtooth, Noise, Custom
Examples
Basic Sine Wave Generator
FreqGen
The frequency is controlled by adjusting the potentiometer on the panel.
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
FreqGenMulti
The frequency is controlled by adjusting the potentiometer on the panel, the waveform is controlled by adjusting the switches on the panel.
Downloadable macro reference
GenerateTick
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.
Parameters
- This macro has no parameters
Return value
- This call does not return a value
Generate
Fills the specified 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 subsequest cycles.
Parameters
- This macro has no parameters
Return value
- This call does not return a value
SetOffset
Sets the period offset to a new value to alter the waveform output rate.
Parameters
- FLOAT OffsetRate
- 0.2=F/5 0.5=F/2 1.0=F 1.5=F*1.5 2.0=F*2
Return value
- This call does not return a value
Simulation macro reference
This component does not contain any simulation macros
Property reference
Buffer Manager
This property is of type Fixed list of ints and can be referenced with the variable name buffer_manager.
Selects the DSP buffer manager component
Output
This property is of type Fixed list of ints and can be referenced with the variable name input_a.
Selects the buffer to assign the waveform data to
Type
This property is of type Fixed list of ints and can be referenced with the variable name wave_type.
Waveform type selection
Amplitude
This property is of type Signed integer and can be referenced with the variable name wave_amplitude.
Waveform amplitude or volume
Offset
This property is of type Signed integer and can be referenced with the variable name wave_offset.
Waveform DC offset
Period
This property is of type Signed integer and can be referenced with the variable name wave_period.
Waveform period, the number of samples in the cyclic wave
Phase
This property is of type Fixed list of ints and can be referenced with the variable name wave_phase.
Waveform phase, the point in the wave to start streaming from
Data
This property is of type Line of text and can be referenced with the variable name wave_data.
The raw waveform data
Period Offset
This property is of type Floating point and can be referenced with the variable name PeriodOffset.
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
Sample Rate (hz)
This property is of type Floating point and can be referenced with the variable name sample_rate.
Allows the sample rate to be entered to allow some basic calculations
Period (s)
This property is of type Floating point and can be referenced with the variable name calc_period.
The length of time in seconds that the wave period will cover at the specified sample rate
Frequency (hz)
This property is of type Floating point and can be referenced with the variable name calc_freq.
The repeat frequency of the wave at the specified sample rate