This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Usage of 24-bit ADC with AT89S52

I want to use 24bit ADC (SPI, e.g. AD7730) with Atmel 89S52 for instrumentation purpose.
I also want to use 16bit AD7705 ADC with Atmel 89S52.
Please suggest best suitable variable routine within 128 bytes of data memory.

Parents
  • Rolling averages over 50 24-bit samples (of random value) requires 50*3 = 150 bytes of RAM.

    In short - you can't solve for the general case. You must make assumptions about the variance of the samples (frequency of input signal including noise in relation to sample frequency), i.e. if you can store a delta from previous sample, and how many bits you need for the delta to make sure it never overflows.

    With a 16-bit delta, you can manage with 4-byte sum, 2 or 4-byte absolute value and 49*2 bytes of delta. 104 or 106 bytes in total. If your sample frequency is fast enough, you could manage with a 12 or 8-bit delta, but then you must make very sure that you have proper low-pass filtering of the input signal or very bad things will happen with your avaraging code.

Reply
  • Rolling averages over 50 24-bit samples (of random value) requires 50*3 = 150 bytes of RAM.

    In short - you can't solve for the general case. You must make assumptions about the variance of the samples (frequency of input signal including noise in relation to sample frequency), i.e. if you can store a delta from previous sample, and how many bits you need for the delta to make sure it never overflows.

    With a 16-bit delta, you can manage with 4-byte sum, 2 or 4-byte absolute value and 49*2 bytes of delta. 104 or 106 bytes in total. If your sample frequency is fast enough, you could manage with a 12 or 8-bit delta, but then you must make very sure that you have proper low-pass filtering of the input signal or very bad things will happen with your avaraging code.

Children
  • there is a way

    make it 64 samples to average
    have
    one slot "new"
    two slots "two"
    two slots "four
    tho slots "eight"
    tho slots "sixteen"
    two slots "thirtytwo"
    one slot "result"
    12 slots
    make the "two" slots alterantively average two readings in "new", when both are full, make the "four" slots alterantively average two readings in "two", when both are full...

    code from the days when SRAM cost money :)

    Why on earth do you not get a chip with some decent RAM there are several with 8k and about anythingg inbetween.

    Eriik