PDA

View Full Version : Setting Address via ADC



breesy
- 14th October 2007, 09:34
Hi,

Just wondering if anyone has any experience or thoughts on setting the ID of a PIC by using the ADC and a resistor network, and mapping the value to an ID on startup. I would like to be able to use an 8-pin chip in a project where I have about 30 devices on a common serial line, but will only have a single free pin. I am aware that the maximum impedance recommended by the datasheet is 10 kOhm and the ADC is 10-bit. I believe the 1% tolerance resistors come in frequent values, hence my thought was something along the lines of a 1k pull up resistor, and using values spaced from 0 to 9k between the pin and ground, thus producing a range of voltages between 0 and 4.5V (5V supply).. Naturally the ADC value will not be exact (nor will resistor voltages), but if I aimed for 50 devices, by my calculations that would leave me +/- 9 ADC values before reading the wrong ID. Is this too small? This is also assuming I can find a perfectly spaced range of resistor values. Space and cost are crucial, hence the choice of small and cheap resistors. Doable?

Daniel

Jerson
- 14th October 2007, 12:35
Definitely doable, but not necessarily a workable idea. The fact that your IDs are located across 50 devices, brings into play Vcc considerations too. If the VCC across devices varies, you will have ID overlaps. So, it may not work.

Dave
- 14th October 2007, 14:33
breesy, As long as you have the reference for the A/D selected as VDD and VSS as well as the same source used for the resistor divider then it wil work perfectly. The A/D is then ratiometric as far as the source voltage. I would use 1% resistors with the same temperature coefficient.

Dave Purola,
N8NTA