adc0808 interfacing with 8051
You can connect the ADC as an external memory and this will save I/O pins for you:
Connect as the following:
ADC D0-D7 ------- 8051 P0.0 -P0.7
ADC EOC -------- 8051 INT0 (P3.2)
ADC SOC ------- 8051 Any Free Pin (P1.0 for example)
ADC A0,A1,A2 ----- 8051 A13(P2.5), A14(P2.6), A15(P2.7)
Now you can access the analog data (N0-N7) as 7 RAM memory addresses
Example:
Binary adress of N0 = (A15 MSB) 000x xxxx xxxx xxxx (A0 LSB)
Binary adress of N3 = (A15 MSB) 011x xxxx xxxx xxxx (A0 LSB)
Binary adress of N7 = (A15 MSB) 111x xxxx xxxx xxxx (A0 LSB)
1 - In your program you can initiate conversion by writting SOC (P1.0)
2- Wait for Interrupt INT0
3- In Interrupt service routine read analog data from the corresponding memory address
Did I forget Anything ?