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);
}
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 {

View File

@ -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,

View File

@ -49,7 +49,6 @@ void SigGenProcessor::execute(const buffer_c8_t& buffer) {
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.
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,7 +78,14 @@ 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 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
@ -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;
}
}