From 0a90ce8afdbbcdafb89cc13261a38b9f99067a66 Mon Sep 17 00:00:00 2001 From: guido Date: Mon, 28 Jan 2019 22:25:21 +0100 Subject: [PATCH] Fix performance issue and file-naming issue. --- qcx-ssb.ino => QCX-SSB.ino | 19 ++++++++----------- README.md | 2 +- 2 files changed, 9 insertions(+), 12 deletions(-) rename qcx-ssb.ino => QCX-SSB.ino (97%) diff --git a/qcx-ssb.ino b/QCX-SSB.ino similarity index 97% rename from qcx-ssb.ino rename to QCX-SSB.ino index 475baa5..3c55802 100644 --- a/qcx-ssb.ino +++ b/QCX-SSB.ino @@ -378,16 +378,6 @@ inline void vox(int8_t amp) } volatile uint8_t drive = 4; -void set_pwm_pa(uint8_t amp) -{ - // Based on amplitude set the PA voltage through PWM. The following voltages at L4 have been measured for various PWM values: 0x00 (0.48V), 0x10 (0.50V), 0x1A (0.54V), 0x1D (0.66V), 0x20 (3.4-7V), 0x30 (6.5-11V), 0x40 (9.96V), 0x60 (11V), 0x80 (11.5V), 0xFF (11.8V) - #define KEY_OUT_PWM_MIN 0x1D // The PWM (threshold) value where the voltage over L4 just start rising ~0.6V - #define KEY_OUT_PWM_MAX 0x60 // The PWM value where the maximum voltage over L4 is approximated ~11V - if(drive == 0) // constant-carrier SSB - OCR1BL = 0xFF; - else - OCR1BL = amp / (0xFF/(KEY_OUT_PWM_MAX - KEY_OUT_PWM_MIN)) + KEY_OUT_PWM_MIN; // Set PWM amplitude at OC1B (KEY_OUT) in the working range of the PA supply (1 to 11V) --> the current implmentation is quite crude: it would be nice if we can linearize this via a calibration technique -} #define F_SAMP 4400 #define MAX_DP 360 // the occupied SSB bandwidth can be further reduced by restricting the maximum phase change (set MAX_DP to 180). @@ -413,7 +403,14 @@ inline int16_t ssb(uint8_t in) amp *= drive; //scale so that input amplitude is full scale; drive=4 seems a good drive amp = (amp > 255) ? 255 : amp; // clip - set_pwm_pa(amp); + // Based on amplitude set the PA voltage through PWM. The following voltages at L4 have been measured for various PWM values: 0x00 (0.48V), 0x10 (0.50V), 0x1A (0.54V), 0x1D (0.66V), 0x20 (3.4-7V), 0x30 (6.5-11V), 0x40 (9.96V), 0x60 (11V), 0x80 (11.5V), 0xFF (11.8V) + #define KEY_OUT_PWM_MIN 0x1D // The PWM (threshold) value where the voltage over L4 just start rising ~0.6V + #define KEY_OUT_PWM_MAX 0x60 // The PWM value where the maximum voltage over L4 is approximated ~11V + if(drive == 0) // constant-carrier SSB + OCR1BL = 0xFF; + else + OCR1BL = amp / (0xFF/(KEY_OUT_PWM_MAX - KEY_OUT_PWM_MIN)) + KEY_OUT_PWM_MIN; // Set PWM amplitude at OC1B (KEY_OUT) in the working range of the PA supply (1 to 11V) --> the current implmentation is quite crude: it would be nice if we can linearize this via a calibration technique + vox(v[1]+v[6]+v[13]+v[17]+v[24]); //i+=1; // make phasor off-center redcudes noise: may improve quality diff --git a/README.md b/README.md index e48041d..1023278 100644 --- a/README.md +++ b/README.md @@ -145,7 +145,7 @@ LPF-bank/matching-network may be placed instead of the existing LPF C25-C28, L1- [QCX-SSB]: https://github.com/threeme3/QCX-SSB -[QCX-SSB Sketch]: https://raw.githubusercontent.com/threeme3/QCX-SSB/master/qcx-ssb.ino +[QCX-SSB Sketch]: https://raw.githubusercontent.com/threeme3/QCX-SSB/master/QCX-SSB.ino [X1M-mic]: https://vignette.wikia.nocookie.net/x1m/images/f/f1/X1M_mic_pinout_diagram.jpg/revision/latest?cb=20131028014710