On Tue, Nov 26, 2024 at 02:19 AM, Bob Smith wrote:
BTW: is your code posted anywhere?
I don't think it can exist now other than on my laptop :)
?
As you know, a delta bits stream is defined by 3 parameters:
[1] The frequency of the delta clock (say, Fclock).
[2] The number of delta bits in a cycle (say, Nbits).
[3] The delta step (say, Dstep).
?
Fclock depends on how fast the code loop is. I had to use the old MCU, ATmega32A. My code loop is 4 MCU cycles (2 MHz bit rate with an 8MHz crystal).
?
I started the Nbits from 96 bits and ended at 3088 bits. This produces the frequencies from 20833 Hz down to 647.67 Hz (the high band). By lowering 32 times the bit rate (62,500 Hz), the same delta bits streams of the high band produce the frequencies from 651.04 Hz down to 20.240 Hz (the low band). Each band has 485 frequencies: 970 frequencies total. The ratio of two consecutive frequencies is between 1.04% and 0.52%.?
?
The problem is to find the Dstep that generates the delta bits and satisfies a certain condition; like lowest THD for each frequency or constant amplitude for all frequencies, for example.?
?
Since I had no clear idea on how to let the MCU calculate the THD of a bit stream, I chose the second one which is rather easy to code.
So, my first basic code (sorry, I had to write all my codes, since many decades ago, in assembly language only, because of sanctions) generates a table (written on the MCU EEPROM, size 1024 bytes) of the 485 Dstep's (2 bytes each) which lets the generated amplitudes be close to a certain level.?
?
The second basic code uses the results (Dstep's table) from the first one to output a sinewave once it gets a frequency index [0 to 969].
To test the code, I decided to use 3 encoded BCD 10-state thumbwheels connected to 12 IO pins. I also added a push-button to break the wave loop in order to generate another frequency whose index is set already on the thumbwheels.
?
I guess it is clear that my project is more about advanced programming than electronics. I have always no problem to share my work with others (for instance, I personally have 'nothing' to hide in my entire life; intellectual and personal as well). It is up to the owner of the list, since I am just a guest, if discussing here this project in detail is a good idea or not.
?
Kerim