PDA

View Full Version : read 1 sensor with 2 PICs?



PICn_n_grinnin
- 25th June 2006, 08:03
Hello All,
I am trying to read a resistive type sensor connected to two PICs, a 16F88 and a 16F685. When either PIC is connected to the sensor by itself, it works fine. But when both are connected, neither one reads correctly. The sensor has a range of 0 to 90 Ohms, and I'm using a 100 Ohm resistor between the input pin and Vcc on each PIC.
I'm sure you're asking yourselves why I don't just have one PIC perform both functions... well it's a long, ugly story. Let's just say I'm stuck with this setup and I have to make it work (or not). I'm using the default settings for ADCIN.
Any tips, hints, enlightened insights would be much appreciated. I really need to put this project (and myself) to bed.
Thanks in advance,
Pete K.
P.S. I have a hunch that the problem lies more in the circuit than in the software. Then again, the last time I had a hunch I lost a hundred bucks at the Blackjack table in Vegas!

mat janssen
- 25th June 2006, 11:35
Can you bring this part to an opamp, wired as a buffer, and the output of the buffer to the inputs of your pic's.

arniepj
- 25th June 2006, 14:58
An A/D chip with serial output could also be an option.Feed the serial output to both Pic's.

PICn_n_grinnin
- 25th June 2006, 16:02
Mat and Arnie - thanks for your replies. I should have mentioned that the circuits in question have already been built, and any changes other than adding a resistor here, a diode there, would mean a re-design and I'm afraid that at this point, that's not an option.
Perhaps I should rephrase my original question to read: Should the setup I'm currently using work, or am I just wasting my time trying to get it to? I just realized that what I'm doing, in effect, is connecting the A/D input pins of the two PICs together with the output from the sensor, and having the two inputs tied to each other might be confusing the A/D converters in both PICs. Am I thinking along the right lines here? If so, would there be a fairly simple work-around, or should I just scrap the whole idea and go with one of your suggestions?
Thanks again, guys. My butt's in a sling here, and I really appreciate your input.

I just had another though as I was keying this in - how about (if I'm forced to redo this mess) using a third PIC that has an A/D converter and two hardware PWM channels on it, with the A/D connected to the sensor and each of the HPWM outputs going to one of the two existing PICs?

Acetronics2
- 25th June 2006, 16:20
Hi, Picn' ...

QUOTE [ and I'm using a 100 Ohm resistor between the input pin and Vcc on each PIC. ]

Wonder if there is really ONE resistor for EACH Pic ...

Logically, there must be only ONE resistor in series with your probe ... so, the second PIC input must NOT have a 100 Ohms resistor from +5v ...

I'm not sure ... but that can be a very good reason for misrunning ...

Alain

PICn_n_grinnin
- 25th June 2006, 17:11
Hello Alain,
Thanks for your reply. I think we tried the setup with only one resistor, but now I can't remember for sure... I'll be going to the lab later today and will try that. Do you think there should not be a problem with having the two PIC's A/D pins tied together?

Acetronics2
- 25th June 2006, 17:29
Hi,

For the supply, if the two PICS have a COMMON GROUND and BOTH a very close to 5 v supply ( do not forget PIC protection diodes on the inputs ...), I don't see any problem ... as your sensor impedance is low enough.

For common Ground ... keep in mind there should be only 1 common ground connection point to avoid "ground loops" ...

Alain

a scheme of each of your ADCs inputs could help greatly too ...

PICn_n_grinnin
- 25th June 2006, 17:57
Alain,
The two PICs are on seperate circuit boards, each with its own 5V. switching regulator, and there is a common ground between the boards. I'm a little unclear as to what you mean by the protection diodes. What type of diode and where should they be placed?
Thanks,
Pete

Acetronics2
- 25th June 2006, 18:12
These are INTERNAL Pic protection diodes ... If supply voltage of the 2 Pics were differents, that could create problems, so we must not forget them in such situations !!!

One more point, is your sensor connected to ground on one of its sides ???

Alain

PICn_n_grinnin
- 25th June 2006, 18:20
Alain,
OK, my face is sufficiently red! I forgot to take my smart pill this morning. As I mentioned, I will try the single resistor and will let you know the results.
Pete