David Covert wrote: > > This past Friday night, I tried for the first time to program and > implement a PIC. To my great surprise, I had a 16C84 blinking a LED > inside of 3 hours. I had several blinking patters inside another 30 > minutes, and I was reading bits from a port in another hour. All in all > I was astounded at how well things went... > > Now that I have gotten tired of blinking lights, I am on to bigger and > better things... I am thinking A/D... so... > > 1) What is the best A/D to use with a C84? (8 to 12 bit, 1 to 8 channel, > serial, minimal external component count) I know there are a lot of > different answers to this. That is what I am hoping for... Please > reply to me directly... I don't want to clutter the list with what I am > sure is an old, tired thread. > > 2) I am using Hi-Tech's beta C compiler. How can I add in or link ASM > routines? (Such as routines to clock in a word from an A/D if C routines > are not available). I do not wish reinvint the wheel unless I have to... > > Thank you for your time, > Dave Covert Here's a nice way of doing it with your 16c84 : Pull a pin low (through a resistor). Change the pin direction to input (high impedance), and start a counter. Count the cycles it takes the input to 'trip' the pin to high. It's only drawback is that it is not as fast as a dedicated A/D. The resolution, however, depends on your counter period. Here's an attempt at the circuit : | | R1 R2 PIC |-----/\/\/-----------\/\/\/------> Your analogue input | | | ----- ---- ----- C1 | | Ground Your sampling time is determined by R2*C1. R1 is to protect the PIC. Friendly Regards Tjaart van der Walt ______________________________________________________________ | Another sun-deprived R&D Engineer slaving away in a dungeon | |WASP International GSM vehicle tracking and datacomm solutions| |+27-(0)11-622-8686 | http://wasp.co.za | tjaart@wasp.co.za | |______________________________________________________________|