Sampling on an 8051 MCU
Part of the features we had to develop for the ROV was sampling from sensors. At the time all I had was an 8051 microcontroller, so I got an ADC0808 IC and made this sampler, outputing to four 7-seg displays, one showing the ADC's channel, the others the value it was outputing.
The program itself is very simple. All it does is, select a channel, start the conversion by changing the state of certain inputs and wait for the EOC flag to go up. Then it reads the 8-bit value and either stores it or displays it (this circuit does the latter, though ofcourse the former is its real purpose). It does cost the MCU quite a bit of pins, so I might make a driver circuit in the future that initiates the conversion automatically, in order to free up pins (although you can always just use busses and latches to make use of those pins on more applications).
A very useful property of this circuit is that as long as you use an ADC of the same series and precision, you can just switch the ADC IC, change nothing else and it will work. This applies mainly to the case you want to increase sampling speed (the ADC0808 has a sampling speed of about 10KHz).
Here you can see the microcontroller and the sampler. I didn't use busses in this diagram but if I were to redraw it I'd do it that way since it's a bit clearer. The input lines can be connected to anything providing a voltage within the ADC's reference, so as long as you make sure its in the range the IC can understand and won't be damaged by, you can connect almost anything onto it. Here it says thermocouple as that is what we were inteding to connect for proof-of-concept purposes, but generally it is intended for chemical sensors and the like.
For testing, this is the output. Perhaps a bit too much showing the same thing 4 times, heh, but it makes it clearer that there are 4 7-segment displays, not just one.
This part included just for the sake of completeness. These are the basic parts of the circuit for the 8051 microcontroller for its supply and connection to the PC, for programming.