#include #include
#define uchar unsigned char # define IN0 xbyte [0x7ff8] / * Set the channel 0 address of the ADC0809 * / sbit ad_busy = p3 ^ 3; / * EOC status * / void ADC0809 (UCHAR IDATA * X) / * Sampling results Pointer A / D acquisition function * / {uchar i; uchar xdata * ad_adr; ad_adr = & inf; for (i = 0; i <8; i ) / * processing 8 channel * / {* ad_adr = 0; / * start Conversion * / i = i; i = i; / * delay waiting EOC becomes low * / while (ad_busy == 0) / * query waiting conversion end * / x [i] = * ad_adr; / * save conversion result * / AD_ADR ; / * Next channel * /
}}} void main (void) {static uchar iData ad [10]; ADC0809 (AD); / * Sampling ADC0809 channel value * /}