View previous topic :: View next topic |
Author |
Message |
AdrianJ
Joined: 16 Jan 2006 Posts: 2483 Location: Queensland
|
Posted: Thu Feb 05, 2009 10:43 pm Post subject: |
|
|
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 |
|
|
cowboyrx
Joined: 05 Feb 2009 Posts: 6
|
Posted: Fri Feb 06, 2009 12:06 am Post subject: |
|
|
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 |
|
|
AdrianJ
Joined: 16 Jan 2006 Posts: 2483 Location: Queensland
|
Posted: Fri Feb 06, 2009 12:59 am Post subject: |
|
|
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 |
|
|
cowboyrx
Joined: 05 Feb 2009 Posts: 6
|
Posted: Fri Feb 06, 2009 3:56 am Post subject: |
|
|
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 |
|
|
AdrianJ
Joined: 16 Jan 2006 Posts: 2483 Location: Queensland
|
Posted: Fri Feb 06, 2009 4:08 am Post subject: |
|
|
Its not quite that simple ( what is ) . 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 |
|
|
cowboyrx
Joined: 05 Feb 2009 Posts: 6
|
Posted: Mon Feb 09, 2009 5:00 pm Post subject: |
|
|
AdrianJ wrote: | Its not quite that simple ( what is ) . 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 |
|
|
AdrianJ
Joined: 16 Jan 2006 Posts: 2483 Location: Queensland
|
Posted: Mon Feb 09, 2009 10:43 pm Post subject: |
|
|
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 |
|
|
|
|
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
|
|