Another Analog - Digital converter

This is a 4 channel A-D using an 8 pin PIC: the 12f683. This device has an internal RC oscillator at 8MHz which provides the processor clock. It also contains enough flash memory and RAM to do interesting thing with high level languages, hence this project is written in HiTech C. This project was a test bed for a few ideas I wanted to try out. Since the device has enough flash memory and RAM, I used HiTech C as the main language, although the serial I-O uses some assembler I picked up off the internet to implement a bit-banged duplex configuration that runs as 1200Baud.


The ideas I wanted to experiment with were holding some configuration data in eeprom (which is set by the user from the RS232 port) but mainly to see if I could oversample the internal 10 bit A-D converter to extract some additional bits of resolution and stretch it to give 12 bit results. I also wanted to have the device report data back to the PC at predetermined periods (again, defined by user commands).


The circuit is nothing special, as most of the features are implemented on the PIC itself.

The circuit shows 4 analog inputs. These are sampled 16 times each and the results added together to give a 12 bit oversampled measurement. The RS232 interface is simply done with 2 transistors and a diode. While it doesn't give the full RS232 definition +12 to -12 Volt swing, it's good enough for a short cable run to a local PC.



Each output line from the device contains the same fields, of a 4 digit ID, the time in seconds and 2 decimal places since it was switched on or reset and 4 values of analog data. After each line is sent, the device waits for a predetermined time before looping back to re-read the analog - digital converters again.

An example output is:

Temp 00010761.55 0110 0874 0033 2509


The commands that the device will accept are quite simple and comprise an upper case letter with some arguments (in most cases). They are as follows:

   
Iabcd Change the 4 character ident string to abcd
Dhhhhhhhh Set the delay between output lines to hhhhhhhh hundredths of a second
Paa:vv Patch the value vv into the eeprom at address aa.
Patching a 'y' to address 00 makes the changes permanent. Otherwise they are reset next time the device has power applied.
T reset the internal time to 00000000.00 seconds


The source, including te "borrowed" bit-banged assembler routine is here

footnote: I also like the small plastic case this project is in. It's a 30-1957 from Rapid Online