Sujet : Re: DDS, again
De : jeroen (at) *nospam* nospam.please (Jeroen Belleman)
Groupes : sci.electronics.designDate : 11. Dec 2024, 10:02:13
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vjbk75$1f4r4$1@dont-email.me>
References : 1
User-Agent : Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0
On 12/11/24 03:38, john larkin wrote:
I have been unsuccessful in getting LT Spice to simulate a DDS
frequency generator. It's bad enough trying to make the NCO part, but
whenever I get close it stalls or throws convergence errors.
So I wrote a PowerBasic program that's the 32-bit NCO... GC_Num.exe.
Making a proper .WAV file would be a nightmare, so it outputs as a
text file with just time data per line, where data is the
selected number of MS bits of the phase accumulator.
LT Spice can read the file, and then do whatever it wants: sine, DAC,
filter, comparator, FFTs.
https://www.dropbox.com/scl/fo/o0mdxxqvxupg6ynz7i7rx/AMPMbv9NOY4mJFXggTGUqJ8?rlkey=9ecl38npbgy8kxuzd9bako4kr&dl=0
Spice reads the file as a piecewise-linear thing, so wrecks the nice
MSB data steps. I had to fool it by outputting each clocked phase
accumulator value twice, as
bits time
bits time+0.9*clock_period
same data bits both lines. Looks pretty steppy.
On Linux, we have 'sox' that can convert between time-value
pairs and .wav in either direction. I suppose there must be
a Windows version. I suspect the piecewise-linear problem
will still be there.
As for the convergence problems: LTspice doesn't like
discontinuities. Jim Thompson approximated everything with
smooth functions. His favourite was tanh.
Jeroen Belleman