⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jesper's avr pages - minidds.htm

📁 I often need a simple function generator. Just to generate a certain frequency. After all the years
💻 HTM
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0043)http://www.myplace.nu/avr/minidds/index.htm -->
<!-- default header --><HTML><HEAD><TITLE>Jesper's AVR pages - MiniDDS</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META content="Jesper's collection of AVR projects - Mini DDS" name=Description>
<META 
content="dds Direct Digital Synthesis 9832 Frequency counter guitar tuner build project electronics avr mp3 decode thermometer temperature controller ram dram yampp Atmel at90s8515 schematic hardware mega 103 mega103 Atmega IDE ATA interface " 
name=KeyWords><LINK href="Jesper's AVR pages - MiniDDS.files/_style.css" 
rel=stylesheet>
<META content="MSHTML 6.00.2900.3429" name=GENERATOR></HEAD>
<BODY text=#ffffff vLink=#cc33cc aLink=#33ccff link=#66ffff bgColor=#000000 
leftMargin=30>
<CENTER><IMG height=69 alt="" src="Jesper's AVR pages - MiniDDS.files/jap.gif" 
width=385 border=0> <BR><!--hr size="1" style="color: #2BB7D5;"-->
<P><BR></CENTER><FONT face=Verdana size=+3>Mini DDS</FONT> <I>(Direct Digital 
Synthesis)</I> <!-- end of header part --><IMG height=225 alt="" hspace=30 
src="Jesper's AVR pages - MiniDDS.files/sine.jpg" width=300 align=right 
border=0> <BR><BR>
<P>I often need a simple function generator. Just to generate a certain 
frequency. After all the years I've worked with electronics, I still haven't got 
me one. Even though I need it now and then, I just couldn't seem to justify the 
cost of one.<BR>So, standard solution - build one yourself.<BR>I designed a 
simple sinewave generator based on a Analog Devices AD9832 chip. It will 
generate a sinewave from 0.005 to 12 MHz in 0.005 Hz steps.<BR>That's pretty 
good, and definitely good enough for me ! But while waiting for the AD9832 chip 
to arrive, I came up with a very simple version of the DDS synth, using just the 
2313 and a resistor network.
<P>It's controlled over RS232 from a small Windows program, and can generate 
Sine-, Sawtooth-, Trangle- and Sqare-waves ranging from 0.07 Hz to about 200-300 
kHz in 0.07 Hz steps (<I>depending on your crystal</I>).
<P>
<CENTER><IMG height=165 alt="" 
src="Jesper's AVR pages - MiniDDS.files/dds_control.gif" width=263 
border=0><BR><I>Windows Control program</I> 
<P></CENTER><B>I wont go into details about how a DDS synth works. Maybe later. 
The code is pretty simple so you should be able to understand how it works by 
just reading through it.</B>
<P>
<CENTER><IMG height=252 alt="" src="Jesper's AVR pages - MiniDDS.files/pcb.jpg" 
width=300 border=0> <BR><I>Here's the MiniDDS on a PCB that fits in a TEKO 
box.</I> </CENTER>
<P>There's not much to say about the schematic. It's as simple as can be. Just 4 
major parts. A voltage regulator/switch, a RS232 interface chip, the 2313 and 
the R2R resistor network. The R2R network is connected to PORTB on the 2313, 
making it a simple D/A converter and makes it possible to output 256 voltage 
levels. Neither the resistor network or port drivers of the 2313 is of perfect 
linearity, but it works pretty well anyway. But you'll probably need a buffer 
stage as the output impedance is rather high (tens of kOhms in my case). <BR>The 
MAX603 handles the voltage regulation as well as the powerup/shutdown function, 
and is controlled by the DTR signal on the serial interface. So when you shut 
down the control program on the PC, the miniDDS will be shutdown, saving 
battery. 
<P>
<CENTER><A href="http://www.myplace.nu/avr/minidds/minidds_schematic.gif"><IMG 
height=260 alt="" 
src="Jesper's AVR pages - MiniDDS.files/minidds_schematic_small.gif" width=400 
border=0></A> <BR><I>Click image to see a larger schematic.</I> </CENTER>
<P>The software is written in assembler, as it is very short and it need the 
speed in the main loop.<BR>This is the heart of the synth. To be precise, it's 
in the 7 lines of assembler that makes up the main loop.<BR>The rest of the code 
is the wavetables and the communication code.<BR>The phase accumulator uses 24 
bits, which determines the resolution of the output frequency. Maximum available 
frequency and resolution is also dependent on your crystal frequency : 
<P><B>Resolution = fCPU/150994944</B> and 
<P><B>fOut = Accumulator * Resolution</B>
<P>In my case with a <B>11.059200 MHz</B> crystal, the resolution is 
<B>0.073242188 Hz</B>.<BR>To get an output frequency of 1 kHz, we need to use a 
phase accumulator value of <B>0x003556 (13654 decimal)</B>.<BR>This gives an 
output frequency of <B>1000.048835 Hz</B>. Good enough for most hobby work !.
<P>The communication is pretty simple and just allows you to set and read the 
phase accumulator value, as well as selecting the type of output waveform.<BR>It 
uses a 32 bit value for the phase accumulator to be compatible with the larger 
DDS circuit using the AD9832 chip.
<P>
<CENTER><IMG height=225 alt="" 
src="Jesper's AVR pages - MiniDDS.files/square.jpg" width=300 border=0> <IMG 
height=225 alt="" src="Jesper's AVR pages - MiniDDS.files/sawtooth.jpg" 
width=300 border=0> <BR><I>The above pictures (as well as the top one with the 
sine wave) show the waveforms at 100kHz</I> </CENTER>
<P>
<P><FONT size=+1><A 
href="http://www.myplace.nu/avr/minidds/minidds_schematic.gif">View 
schematics</A></FONT> 
<P><FONT size=+1><A 
href="http://www.myplace.nu/avr/minidds/minidds.asm">Download 
ASM-code</A></FONT> 
<P><FONT size=+1><A 
href="http://www.myplace.nu/avr/minidds/ddscontrol.zip">Download Windows Control 
Program 1.02</A></FONT> <BR><FONT size=+2>&nbsp;<BR>&nbsp;<BR></FONT>Comments 
are always welcome at <A href="mailto:jesperh@telia.com">jesperh@telia.com</A> 
<FONT size=+2>&nbsp;<BR>&nbsp;<BR></FONT>
<H3><A href="http://www.myplace.nu/avr/index.htm">[Home]</A></H3>
<P><!-- default footer --><FONT size=+4>&nbsp;<BR>&nbsp;<BR></FONT><!-- Page last updated script --><BR>
<SCRIPT language=JavaScript type=text/javascript><!--	var a;	a=new Date(document.lastModified);	lm_year=a.getYear();lm_year=((lm_year<1000)?((lm_year<70)?2000:1900):0)+lm_year;	lm_month=a.getMonth()+1;lm_month=((lm_month<10)?'0':'')+lm_month;	lm_day=a.getDate();lm_day=((lm_day<10)?'0':'')+lm_day;	document.write("<I><center><font size = -3 color = #6060c0>");	document.write("Site designed and maintained by Jesper Hansen. Page last updated " + lm_year+'-'+lm_month+'-'+lm_day);	document.write("</font></center></I>");// --></SCRIPT>
<!-- end of footer --></P></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -