ADC0808 which is an 8-bit resolution ADC has eight input channels i.e., it can take a maximum of eight analog inputs. The circuit uses the first analog input pin to take the analog input signals from the preset.
To provide clock input to the ADC, Timer0 is used in interrupt enabled mode to generate a clock of frequency 500 KHz. To enable the Timer0 in interrupt enable mode, the register IE is loaded with the value 0x82. Every time the timer completes the counting, pin P1.2 toggles its state. (Refer interfacing ADC0808 using clock from AT89C51).
The output pins of ADC are connected to the port P0 of the controller. The pin10 of the ADC is connected to pin8 (P1.7) of the controller for clock input. ALE, pin 22 of the ADC is connected to pin 1 (P1.0) of controller. OE, pin9 of the ADC is connected to pin 4 (P1.3) of controller. SC, pin6 of the ADC is connected to pin 2 (P1.1) of the controller. EOC, pin7 is connected to pin 3 (P1.2) of controller. Selector pins A (25), B (24) and C (24) of ADC are connected to the pins 4, 5 and 6 of the controller respectively.
The port P0 is continuously scanned and the output of the ADC is transmitted via serial port. The value of the port P0 is loaded in the SBUF register and sent via TxD (pin11) of the controller. Hyper Terminal shows character corresponding to the ASCII values 0-255 (Refer serial port interfacing with AT89C51 for hyper terminal settings).