This is a php program that produces sets of hex codes which can be loaded into an Analog Devices AD9833 or AD9837 DDS chip to produce sweep frequency sets. You may hide/show any section that has a coloured background ± in its title.
Introduction: ±
Little breakout boards with these chips (especially the 10 lead MSOP AD9833)
are becoming quite cheap. (I can't buy the bare ICs for less than these boards),
so I thought it was time to “refactor” (software Engineering lingo
for “fix”) this page...
Some features:
- The resultant values are rounded to integers to maximize the accuracy, then converted to the hex/binary format needed;
- The error from the ideal is printed for each computed value, both as an absolute and a percentage;
- The maximum error (the resolution) is calculated as a function of the master clock being used. This does not include whatever error is inherent in your oscillator;
- Sweeps can be ascending or descending;
- Either linear or logarithmic sweeps can be selected;
- The waveshape may be selected (sine, triangle or square);
- Whether to use one frequency register or two is selectable;
- The user can request that single-register writes be used if possible;
- The outputs are formatted such that they can be just dropped into an assembler file.
How to use: ±
- Enter the chip's master clock frequency. Keep at or below the maximum for the chip;
- Enter the start value in the “Start Value:” box. Zero or negative numbers are replaced by 1;
- Similarly, enter the top value to use in the “End Value:” box. The end value can be lower than the start value, to produce decreasing steps;
- Enter the number of steps. There may be one more value produced in the table, depending on the “Add top value at end?” option;
- If the end value is wanted (at the end of the sequence, of course), tick the “Add top value at end?” box;
- Pick the waveform;
- If you want to know the effective gain error, check the “Show sin(x)/x factor?” box. More important with higher frequencies;
- The Method buttons choose between linear or log sweeps;
- It is recommended by ADI to alternate the frequency registers to produce the cleanest sweep, however this is not always desireable or necessary. The “Use one frequency register?” box controls this;
- The initial frequency register to use can be chosen by the last pair of “radio buttons ” Having control of this will allow chaining of tables together since the register selection should always alternate if both are used. If one register is being used this box selects it;
- The frequency registers are composed of two 14-bit parts. The chips can be set up to receive only one of the parts. This halves the amount of data and increases the update rate. Checking the “Use single writes if possible?” box allows the rediuction if and only if the MS14 bits are constant.;
- The next input field of the form is the “Double byte prefix?” box. This defaults to FCB for Freescale (Motorola) syntax, however DB could be used for other assemblers. If it is blank, then the whole code table generation step is skipped. At the end a C-like array is also produced. Note that the entries are heavily commented;
Some examples: ±
- To generate all 88 piano notes (see Wikipedia ) click here. Compare the last generated note, 4.186009005 kHz to the Wikipedia page's value, 4186.009: can't get any better!
- One can extend the concept to the theoretical 109-note piano from the same reference: click here. There is a slight difference in the top notes here: 7.90213301 kHz generated vs 7902.133 Hz from the table, but the difference is two digits past the table's numeric representation.
Page visited: Saturday, Nov 23rd, 2024 at 3:56am PST. Last updated: Jan 16, 2021.