| OH1TV OH1O OH1WX | |||||||||||
| DDS experiments | |||||||||||
| About a year ago I started to experiment with PIC-processors. I had no earlier experience with any kind of processors | |||||||||||
| nor programming them. I had always thought that it would be too late for me in this age (65). But then a friend told it is | |||||||||||
| reasonable simple and great fun. And I made a try. | |||||||||||
| Since then I have built thermometers, humidity meters, memory keyers, remote heads, etc. | |||||||||||
| Another mystery for me had been DDS, and mainly because a processor is needed to feed the control words. | |||||||||||
| Now, having some touch to PIC I decided to try a self made DDS for HF. Cheap DDS-modules from China had | |||||||||||
| solved the most difficult HW-problem, SMD soldering. | |||||||||||
| To make a DDS you have four thing to do, in HW and SW | |||||||||||
| 1 | Inputs, tell the DDS, what it should do, mainly frequency | ||||||||||
| 2 | Display, show the out coming frequency in Hz | ||||||||||
| 3 | Conversion calculation | ||||||||||
| 4 | Load the DDS chip itself | ||||||||||
| The loaded control word to DDS chip is not the frequency directly but a calculated value thereof. | |||||||||||
| The other input is a multiplier, which with 125MHz clock is 34359.738 when the frequency is given in kHz. | |||||||||||
| To learn mode about the numbers, see AD9850 data sheet. | |||||||||||
| Anyway, multiplication 14023.550 X 34359.738 with a 8-bit processor seemed first to be impossible. | |||||||||||
| Picaxe can multiply byte x byte = word, where a byte is 8 bits or max 255 and a word 16 bits or 65535. | |||||||||||
| The same limitations apply to other arithmetic calculations. | |||||||||||
| My way to solve this is as follows: I use the method we were instructed in the school, use a pen and paper. | |||||||||||
| Instead of decimal numbers I use 256-based numeral system (what a 8 bit byte is). | |||||||||||
| Now byte x byte capability is enough. Quite many steps are needed but the process is very clear. | |||||||||||
| When the frequency and the multiplier are expressed with three bytes, the calculation error this way is | |||||||||||
| less than 0.1Hz on HF. | |||||||||||
| Feeding the control word to DDS chip AD9850 is like SPI feed (Serial Peripheral Interface) | |||||||||||
| Picaxe can handle synchronous SPI in two different ways. HW-based is fast but sends most significant bit first. | |||||||||||
| SW-based spiout-command is slow but has options to send either most significant bit or less significant bit first. | |||||||||||
| AD9850 chip wants LSB first, only SW based instruction can be used. | |||||||||||
| I built a testbed and wrote first a code for the push button controlled version of DDS-VFO. | |||||||||||
| Schematic diagram and the code are on the next pages. | |||||||||||
| I think the comments on SW page explain what the equipment can do | |||||||||||
| Processor standard speed 8MHz is more than enough in the push button controlled version. | |||||||||||
| The next step was to add a rotary encoder as an input device. The code to read the encoder could be | |||||||||||
| a story of its own. I made this one for a K3 remote head last summer and took it as such here. | |||||||||||
| Another thing rose up along the encoder, the speed. The display couldn't follow the knob fast enough. | |||||||||||
| I first increased the processor clock to 64MHz, which is the max. It helped a little but not enough. | |||||||||||
| The time consumer was the Picaxe AXE133Y serial display. Serial transfer is only 2400baud, which is sloow here. | |||||||||||
| I had also Sparkfun COM-11443 serial displays, which accept much higher speeds and can be run in SPI-mode | |||||||||||
| up to 250kHz. As SPI is synchronous it should be more reliable. I changed to this and use the SPI mode. | |||||||||||
| I measured the SPI clock speed to be 50kHz, when PIC clock is 64MHz and SW-based command spiout is used. | |||||||||||
| HW based hspiout-command would run 1/64 of processor clock which would be too fast for the display. | |||||||||||
| That's why I use the slower spiout, the same as loading the DDS-chip. | |||||||||||
| With this setup tuning speed is good. Not super fast but fast enough. | |||||||||||
| Diagram and code are shown on the next pages. | |||||||||||
| I have tested both versions with a direct conversion receiver made for 20m CW. Results are very encouraging. | |||||||||||
| 25.2.2014 | |||||||||||
| Pekka, OH1TV | |||||||||||
| DDS with push buttons | |||||||||||
| DDS with rotary encoder | |||||||||||
| Back to projects page | |||||||||||