Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

Direct Digital Synthesis. (DDS)
Goto page Previous  1, 2, 3, 4, 5, 6
 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    www.mcselec.com Forum Index -> BASCOM-AVR Archive
View previous topic :: View next topic  
Author Message
AdrianJ

Bascom Expert



Joined: 16 Jan 2006
Posts: 2483
Location: Queensland

australia.gif
PostPosted: Thu Feb 05, 2009 10:43 pm    Post subject: Reply with quote

With some limitations, yes. But only at low frequencies, say less than 1 KHz, and relatively low resolution, usually 8 bit, 265 levels or steps in the wave. You still need a good filter on the 1 pin output, and the extra components there are usually more that just putting a DAC on an 8 bit port. Reread carefully all the posts in this very long discussion.
Rather than use an R-2R ladder, use a DAC, like for example the MAX5100/5102, very simple to use. On the whole, you get a much better and easier result.

_________________
Adrian Jansen
Computer language is a framework for creativity
Back to top
View user's profile Visit poster's website
cowboyrx

Bascom Member



Joined: 05 Feb 2009
Posts: 6

blank.gif
PostPosted: Fri Feb 06, 2009 12:06 am    Post subject: Reply with quote

AdrianJ wrote:
With some limitations, yes. But only at low frequencies, say less than 1 KHz, and relatively low resolution, usually 8 bit, 265 levels or steps in the wave. You still need a good filter on the 1 pin output, and the extra components there are usually more that just putting a DAC on an 8 bit port. Reread carefully all the posts in this very long discussion.
Rather than use an R-2R ladder, use a DAC, like for example the MAX5100/5102, very simple to use. On the whole, you get a much better and easier result.


Less than 1Khz is okay and I don't mind the steps in the wave, it doesn't have to be a smooth sine wave.
Actually I need to a sine wave with 16 to 64 (changeable) steps on 1 full wave.
Do still need an external DAC? I thought the ADC in the mega48 has the DAC built in?
Back to top
View user's profile
AdrianJ

Bascom Expert



Joined: 16 Jan 2006
Posts: 2483
Location: Queensland

australia.gif
PostPosted: Fri Feb 06, 2009 12:59 am    Post subject: Reply with quote

AFAIK there is no DAC in a Mega48. The PWM output is simply a digital on/off control. By adjusting the on/off time, you adjust the average level on the output, which you then have to filter to produce a slowly varying voltage. The filter has to have a time constant significantly longer than the period of the PWM, so you smooth out the pulses into a useable signal.

I think you would be wise to start a new thread on this topic, if you want to continue discussion, its not really relevant to the DDS. In fact at this stage its not really relevant to use of Bascom either, and probably belongs in forum Various, but its true there is much less activity there.

_________________
Adrian Jansen
Computer language is a framework for creativity
Back to top
View user's profile Visit poster's website
cowboyrx

Bascom Member



Joined: 05 Feb 2009
Posts: 6

blank.gif
PostPosted: Fri Feb 06, 2009 3:56 am    Post subject: Reply with quote

AdrianJ wrote:
With some limitations, yes. But only at low frequencies, say less than 1 KHz, and relatively low resolution, usually 8 bit, 265 levels or steps in the wave. You still need a good filter on the 1 pin output, and the extra components there are usually more that just putting a DAC on an 8 bit port. Reread carefully all the posts in this very long discussion.
Rather than use an R-2R ladder, use a DAC, like for example the MAX5100/5102, very simple to use. On the whole, you get a much better and easier result.

So, I can just connect the output pins from mega48 to the D0-D7 pins on the MAX5102 and expect a sine wave out, with 256 steps?
Back to top
View user's profile
AdrianJ

Bascom Expert



Joined: 16 Jan 2006
Posts: 2483
Location: Queensland

australia.gif
PostPosted: Fri Feb 06, 2009 4:08 am    Post subject: Reply with quote

Its not quite that simple ( what is Smile ) . You need to connect also a write enable line at least, and pulse it high-low-high after you change the data on the port, that triggers a new DAC output. While the enable is high, the DAC output remains constant. Usually you do all that in an interrupt driven by an AVR timer, so the output changes appear at regular intervals - each step on your output waveform. Read the datasheet on the Maxim website for more details.
_________________
Adrian Jansen
Computer language is a framework for creativity
Back to top
View user's profile Visit poster's website
cowboyrx

Bascom Member



Joined: 05 Feb 2009
Posts: 6

blank.gif
PostPosted: Mon Feb 09, 2009 5:00 pm    Post subject: Reply with quote

AdrianJ wrote:
Its not quite that simple ( what is Smile ) . You need to connect also a write enable line at least, and pulse it high-low-high after you change the data on the port, that triggers a new DAC output. While the enable is high, the DAC output remains constant. Usually you do all that in an interrupt driven by an AVR timer, so the output changes appear at regular intervals - each step on your output waveform. Read the datasheet on the Maxim website for more details.

I am trying to understand how does the R2R ladder output a sine wave from 1 output pin?

When the 256 sinetable values are sent to the ports pins, 1 by 1, I assume they are digital. So is each value sending a square pulse of different width?
Back to top
View user's profile
AdrianJ

Bascom Expert



Joined: 16 Jan 2006
Posts: 2483
Location: Queensland

australia.gif
PostPosted: Mon Feb 09, 2009 10:43 pm    Post subject: Reply with quote

It doesnt. An R-2R ladder needs as many pins as you want bits in the output resolution. To do this on one pin, you need to feed a varying pulse width to the pin, ON for longer to get higher average output voltage, shorter to get lower. And you need a filter to smooth out the pulses to a slow varying voltage. Using one pin and filtering, and using an R-2R ladder or DAC are two entirely different ways of achieving similar results.
_________________
Adrian Jansen
Computer language is a framework for creativity
Back to top
View user's profile Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    www.mcselec.com Forum Index -> BASCOM-AVR Archive All times are GMT + 1 Hour
Goto page Previous  1, 2, 3, 4, 5, 6
Page 6 of 6

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum