Added different modulations in signal generator

* Added DSB, AM 100% mod index and AM 50% mod index. 
* Changed UI.
* Added pulsed CW
This commit is contained in:
Davide Rovelli 2025-03-03 22:17:56 +01:00 committed by GitHub
parent ddf7f7ccb5
commit b6e498a6d3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 15 additions and 9 deletions

View File

@ -118,7 +118,7 @@ SigGenView::SigGenView(
symfield_tone.hidden(false); symfield_tone.hidden(false);
} }
if ((v == 0) || (v == 2) || (v == 3)) { // In Modulation Options CW, QPSK, BPSK we are not using Shapes. if ((v == 0) || (v == 2) || (v == 3) || (v == 7)) { // In Modulation Options CW, QPSK, BPSK, Pulsed CW we are not using Shapes.
options_shape.hidden(true); options_shape.hidden(true);
text_shape.hidden(true); text_shape.hidden(true);
} else { } else {

View File

@ -123,7 +123,8 @@ class SigGenView : public View {
{"QPSK", 3}, {"QPSK", 3},
{"DSB", 4}, {"DSB", 4},
{"AM 100% dep.", 5}, {"AM 100% dep.", 5},
{"AM 50% depth", 6}}}; {"AM 50% depth", 6},
{"Pulse CW 25%", 7}}};
TransmitterView tx_view{ TransmitterView tx_view{
16 * 16, 16 * 16,

View File

@ -48,8 +48,7 @@ void SigGenProcessor::execute(const buffer_c8_t& buffer) {
im = 0; im = 0;
tone_phase += tone_delta; // In BPSK-QSPK we are using to calculate each 1/4 of the periode. tone_phase += tone_delta; // In BPSK-QSPK we are using to calculate each 1/4 of the periode.
} else if (modulation == 3) { } else if (modulation == 3) {
// Digital QPSK consecutive 00, 01, 10, 11,00, ...continuous cycle ,2 bits/symbol, at rate of 4 symbols / Freq Tone Periode. not random., without any Pulse shape at the moment . // Digital QPSK consecutive 00, 01, 10, 11,00, ...continuous cycle ,2 bits/symbol, at rate of 4 symbols / Freq Tone Periode. not random., without any Pulse shape at the moment.
switch (((tone_phase & 0xFF000000) >> 24)) { switch (((tone_phase & 0xFF000000) >> 24)) {
case 0 ... 63: // equivalent to 1/4 of total 360º degrees. case 0 ... 63: // equivalent to 1/4 of total 360º degrees.
/* "00" */ /* "00" */
@ -62,7 +61,6 @@ void SigGenProcessor::execute(const buffer_c8_t& buffer) {
re = (sine_table_i8[96]); // symbol-phasor 135º re = (sine_table_i8[96]); // symbol-phasor 135º
im = (sine_table_i8[96 + 64]); // 96 index = 32 + 256/4 im = (sine_table_i8[96 + 64]); // 96 index = 32 + 256/4
break; break;
break;
case 128 ... 191: case 128 ... 191:
/* "10" */ /* "10" */
@ -80,8 +78,15 @@ void SigGenProcessor::execute(const buffer_c8_t& buffer) {
break; break;
} }
tone_phase += tone_delta; // In BPSK-QSPK we are using to calculate each 1/4 of the periode. tone_phase += tone_delta; // In BPSK-QSPK we are using to calculate each 1/4 of the periode.
} else if (modulation == 7) {
} else { // Other modulations: FM, DSB, AM // Pulsed CW, 25% duty cycle.
if (tone_phase < 1073741824) // 1073741824 = 2^32*(25/100)
re = 127;
else
re = 0;
im = 0;
tone_phase += tone_delta; // In Pulsed CW we are using to calculate each periode.
} else { // Other modulations: FM, DSB, AM
if (tone_shape == 0) { if (tone_shape == 0) {
// Sine // Sine
sample = (sine_table_i8[(tone_phase & 0xFF000000) >> 24]); sample = (sine_table_i8[(tone_phase & 0xFF000000) >> 24]);
@ -141,12 +146,12 @@ void SigGenProcessor::execute(const buffer_c8_t& buffer) {
} else if (modulation == 5) { } else if (modulation == 5) {
// Do AM modulation (100% mod index) // Do AM modulation (100% mod index)
re = (127 >> 1) + (sample >> 1); re = 64 + (sample >> 1); // 64 = 127 - (127 >> 1): carrier level without modulating signal
im = 0; im = 0;
} else if (modulation == 6) { } else if (modulation == 6) {
// Do AM modulation (50% mod index) // Do AM modulation (50% mod index)
re = 95 + (sample >> 2); re = 96 + (sample >> 2); // 96 = 127 - (127 >> 2): carrier level without modulating signal
im = 0; im = 0;
} }
} }