DSADC Application: Volt Meter with RS-232 Output

    Version 1
    Uros Platise, uros.platise@ijs.si, MAPP 10. May 1999 (C) Copyright

    1. Introduction

    One of the most beautiful models of the AVR family micro-controllers is definitely the chip AT90S2313. This application note gives a simple example of the Delta Sigma A/D Converter and basic application, Volt-meter. The result is "printed" to the RS-232 interface.

    2. Schematics

    The schematics is found below in a PDF file. Besides the A/D converter it consist of RS-232 driver and crystal oscillator.

    The value of the capacitor C9 can be obtained by the following equation:

    C9 = 9.5/(R f) [nF]

    where R=R1=R3 is in Mohm, f in MHz. Some values for R=1 Mohm:

    Q1 = 1 MHz, C9 = 9.5 nF
    Q1 = 2 MHz, C9 = 4.7 nF
    Q1 = 4 MHz, C9 = 2.3 nF
    Q1 = 8 MHz, C9 = 1.2 nF
    Q1 = 12 MHz, C9 = 0.8 nF
    Q1 = 16 MHz, C9 = 0.56 nF

    In this example Q1 = 8 MHz and C9 is therefore 1.2 nF. The power supply voltage should be as close as possible to 5 V. The small difference will result in constant offset but bigger changes will gain non-linearity over full scale.

    3. Software

    Example program continuously reads the ADC and prints the result to the RS-232 in the text format. Its output can be viewed with terminal software that supports VT52, VT100 etc. It looks like:

      Hello ADC
      U = 2.66 V

    After the power-up, software initializes the hardware in the following order:

    • sets Stack Pointer address
    • configures UART to 19200 bps and enables Tx part only
    • prints hello message
    • calls ADC initialization function

    Then it enters the never-ending loop which does the following:

    • calls sub-program for A/D conversion
    • scales result from [0,255] to [0,5.00] V using the 8-bit table
    • prints voltage in decimal format to the RS-232

    The schematics also provides Rx line of the RS-232, which is not used in this example.

    Source code is written in "ava" assembler and should be linked together with the object "ds_adc.o" provided by the ADC:

      $ ava v-m.s
      $ ava ds_adc.s -AAT90S2313
      $ ava -o v-m ds_adc.o v-m.o

    4. Conclusion

    This application introduces basic application of the Delta Sigma A/D Converter. Due to high input impedance this meter can be easily extended to temperature meter and so on.

    Due to simplicity of the source code, software uses only 8 bit translation table from range [0,255] to [0,5.00] V and does the 1 LSB error on four positions. The problem can be solved by using the 9-bit table or multiply function, but this task is left to the reader.

    5. Download

    Download asm, this document and schematics (pdf): avr_v-m-1.src.tar.gz


    Home