--- Quote Start ---
thank you for your reply. i'm just wondering why everybody control the gain using an amplifier. I need to change the gain in steps of 1 db till 20 dB. If DAC can handle this?
--- Quote End ---
The reason has to do with dynamic range.
Given a B-bit DAC, you can create a signal with at-best a dynamic range of about 6dB per bit.
If you were to implement 20dB of gain variation in the digital domain, then you would be using up 3 to 4-bits of your DAC to perform that function.
If you only needed 8-bits of dynamic range, and you were using a 12-bit DAC, then great, you can do it digitally.
However, even with that level of control, if the DAC output is too small relative to whatever the voltage you need is, then you have to have an amplifier. You'd likely need this amplifier anyway, as part of an analog filter to remove higher-frequency images from the DAC output (since it has a sort-of stair-case like response for an ideal DAC).
So your two options are;
1) DAC with extra bits, digital gain control, and a fixed-gain amplifier/filter.
2) DAC with just-enough bits, and a variable-gain amplifier/filter with analog gain control (actually the control bits will be digital, but the gain on the analog signal would be 'analog').
Is that clearer?
Cheers,
Dave