From b6e498a6d3f05ae8aaf73d772c8eff89b357a801 Mon Sep 17 00:00:00 2001 From: Davide Rovelli <103165301+daviderud@users.noreply.github.com> Date: Mon, 3 Mar 2025 22:17:56 +0100 Subject: [PATCH] Added different modulations in signal generator * Added DSB, AM 100% mod index and AM 50% mod index. * Changed UI. * Added pulsed CW --- firmware/application/apps/ui_siggen.cpp | 2 +- firmware/application/apps/ui_siggen.hpp | 3 ++- firmware/baseband/proc_siggen.cpp | 19 ++++++++++++------- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/firmware/application/apps/ui_siggen.cpp b/firmware/application/apps/ui_siggen.cpp index 2d4ed3767..428ddc9cf 100644 --- a/firmware/application/apps/ui_siggen.cpp +++ b/firmware/application/apps/ui_siggen.cpp @@ -118,7 +118,7 @@ SigGenView::SigGenView( 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); text_shape.hidden(true); } else { diff --git a/firmware/application/apps/ui_siggen.hpp b/firmware/application/apps/ui_siggen.hpp index 593e3e62d..bbeeba28b 100644 --- a/firmware/application/apps/ui_siggen.hpp +++ b/firmware/application/apps/ui_siggen.hpp @@ -123,7 +123,8 @@ class SigGenView : public View { {"QPSK", 3}, {"DSB", 4}, {"AM 100% dep.", 5}, - {"AM 50% depth", 6}}}; + {"AM 50% depth", 6}, + {"Pulse CW 25%", 7}}}; TransmitterView tx_view{ 16 * 16, diff --git a/firmware/baseband/proc_siggen.cpp b/firmware/baseband/proc_siggen.cpp index 3f118c253..400a5d570 100644 --- a/firmware/baseband/proc_siggen.cpp +++ b/firmware/baseband/proc_siggen.cpp @@ -48,8 +48,7 @@ void SigGenProcessor::execute(const buffer_c8_t& buffer) { im = 0; tone_phase += tone_delta; // In BPSK-QSPK we are using to calculate each 1/4 of the periode. } 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)) { case 0 ... 63: // equivalent to 1/4 of total 360º degrees. /* "00" */ @@ -62,7 +61,6 @@ void SigGenProcessor::execute(const buffer_c8_t& buffer) { re = (sine_table_i8[96]); // symbol-phasor 135º im = (sine_table_i8[96 + 64]); // 96 index = 32 + 256/4 break; - break; case 128 ... 191: /* "10" */ @@ -80,8 +78,15 @@ void SigGenProcessor::execute(const buffer_c8_t& buffer) { break; } tone_phase += tone_delta; // In BPSK-QSPK we are using to calculate each 1/4 of the periode. - - } else { // Other modulations: FM, DSB, AM + } else if (modulation == 7) { + // 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) { // Sine sample = (sine_table_i8[(tone_phase & 0xFF000000) >> 24]); @@ -141,12 +146,12 @@ void SigGenProcessor::execute(const buffer_c8_t& buffer) { } else if (modulation == 5) { // 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; } else if (modulation == 6) { // 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; } }