Re: I need to sample a 12v signal with a PIC...




"Tristan Mumford" <xtristan.xmumford@xxxxxxxxxxx> wrote in message
news:45cfb70a$0$52924$c30e37c6@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Donald Harris wrote:


"Tristan Mumford" <xtristan.xmumford@xxxxxxxxxxx> wrote in message
news:45cf2827$0$83724$c30e37c6@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hello,
Sorry to be a nuisance but I'm afraid I'm a little stuck.
I need to sample 12v signals with a PIC uC. I'm not an engineer nor do I
pretend to be, and if I don't know the answer, or how to find it I ask
:)

Anyway, I'll tell you the reason I need to do this. I need to decode
stepper
motor phases. I've already written most of the firmware for the uC, and
I
know how to implement the rest of the device bar this 12v matter. It's a
one-off thing for my own interest (initially anyway) so the simpler the
better. by simpler I mean cheaper.

Any help with this would be greatly appreciated. Thankyou in advance to
all
those that do.

Tristan.



If you only need to sample the presence or absence of the stepper phases
or
polarity, just put a 22K series resistor in line to the PIC pins. Most
of
the PIC pins have internal diodes to Vdd and Vss. The resistor just
limits
the current in the diodes. Check the data *** to be sure that the pins
you are using have both the diodes. The limiting resistor makes such
sampling even good for 115VAC if you use a 5 Meg resistor.


That i would have to check. It's been a while since I've used a 16f628a.
Most things have been on somewhat larger uCs, but anything bigger would be
overkill.

True enough about the current limiting. It's the difference between a
sample
and a barbecue.

Thanks for your help!


The only I/O pin on the PIC16F628A that doesn't have both protection diodes
is the RA5/MCLR* pin. It only has the one to Vss.

Be careful of voltage dividers. If the ground connection is lost, the magic
smoke tends to escape and things don't work after that.

Don


.