Tutorial for learning the AVR assembly language of AVR single chip controllers AT90S, ATtiny, ATmega and ATxmega of ATMEL usind practical examples. A simple 8-bit-Digital-to-Analog-Converter with a R/2R network Flexible RC filter for the R/2R network |

In this scheme the negative operating voltage VEE is tied to zero Volts (no negative voltages possible). The input signal therefore has to stay at zero Volt or above. Therefore the DC separation capacitor must follow the RC network, its input goes to the output pin of the oerational amplifier behind the R/2R network.

The capacitors are suitable for frequencies, where the attenuation remains below a factor of 2. The diagram therefore displays the 0.5 line.

This cutoff frequency can be calculated from the capatitor value with this equation:

The other way round: to calculate the capacitor from the cutoff frequency use this equation:

In both formulas f is in Hz and C is in Farad.

The cutoff frequencies of the eight capacitors with R=2k2 are listed in the table. Additionally the table lists

- the resolution of the R/2R network
**Res**in this frequency range, - the lower frequency of the range
**f**and the upper_{l}**f**cutoff frequency, and_{u} - the attenuation factors
**A**and_{l}**A**._{u}

Cn | C | f_{0.5} (Hz) | Res | f_{l}(Hz) |
f_{u}(Hz) | A_{l} | A_{u} |
---|---|---|---|---|---|---|---|

C1 | 680 nF | 66.5 | 256 | 10 | 66.5 | 643 | 17,143 |

C2 | 220 nF | 205.7 | 256 | 66.5 | 205.7 | 2,828 | 17,143 |

C3 | 68 nF | 665.4 | 256 | 205.7 | 665.4 | 2,773 | 18,079 |

C4 | 22 nF | 2,056.8 | 128 | 665.4 | 2,056.8 | 748 | 6,005 |

C5 | 6.8 nF | 6,654.4 | 64 | 2,056.8 | 6,654.4 | 165 | 1,781 |

C6 | 2.2 nF | 20,568.1 | 8 | 6,654.4 | 20,568.1 | 4.7 | 27.9 |

C7 | 680 pF | 66,544.0 | 8 | 20,568.1 | 66,544.0 | 5.0 | 28.7 |

C8 | 220 pF | 205,681.4 | 8 | 66,544.0 | 205,681.4 | 1.8 | - |

The attenuations at very high frequencies are not sufficient to suppress harmonics. The frequencies up to 20kHz are correct.

```
FTable:
.dw 0x03F0,0x0001 ; C =680 nF, f 1/2= 66.544 Hz
.dw 0x2371,0x0003 ; C =220 nF, f 1/2= 205.681 Hz
.dw 0x2760,0x000A ; C =68 nF, f 1/2= 665.440 Hz
.dw 0x626E,0x001F ; C =22 nF, f 1/2= 2.057 kHz
.dw 0x89BD,0x0065 ; C =6.8 nF, f 1/2= 6.654 kHz
.dw 0xD847,0x0139 ; C =2.2 nF, f 1/2= 20.568 kHz
.dw 0x6163,0x03F7 ; C =680 pF, f 1/2= 66.544 kHz
.dw 0x72CA,0x0C42 ; C =220 pF, f 1/2= 205.681 kHz
```

With a counter that starts at zero, we pass through the values of the table
and compare the 32 bit frequency in mHz with those. If comparison yields the
carry flag set, we skip the passes. If not, we either add 1 (to yield values
between 0 and 7) with To the top of this page

©2020 by http://www.avr-asm-tutorial.net