View previous topic :: View next topic |
Author |
Message |
gbaugh
Joined: 25 Sep 2003 Posts: 7 Location: Uniontown, PA
|
12VDC sensor to PIC port |
Posted: Mon Mar 15, 2004 3:17 pm |
|
|
I have a sensor that produces a 0 or 12VDC signal. What is the best way to normalize this signal for input to the PIC for HI-LOW state detection?
Thanks! _________________ Greg |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Mar 15, 2004 3:21 pm |
|
|
Voltage divider. Or, if you have a spare receiver input on a
MAX232, you could use that. |
|
|
gbaugh
Joined: 25 Sep 2003 Posts: 7 Location: Uniontown, PA
|
|
Posted: Mon Mar 15, 2004 3:26 pm |
|
|
The freq on the line will be <= 20KHz. Are there problems using a voltage div. in the form of a resistor in line with the port and another to ground? _________________ Greg |
|
|
SherpaDoug
Joined: 07 Sep 2003 Posts: 1640 Location: Cape Cod Mass USA
|
|
Posted: Mon Mar 15, 2004 3:27 pm |
|
|
Microchip AP note AP521 is a great intro to interfacing odd voltages to PIC pins. Definately worth a read. _________________ The search for better is endless. Instead simply find very good and get the job done. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Mar 15, 2004 6:25 pm |
|
|
Quote: | The freq on the line will be <= 20KHz. Are there problems using a
voltage div. in the form of a resistor in line with the port and another
to ground? |
Let's say you use a 3.3K series resistor, followed by a 2.2K to ground.
The output of that circuit goes to a digitial input pin on the PIC.
The period of a 20 KHz signal is 50 usec. A half-cycle is 25 usec.
The input capacitance of the PIC pin is probably 5 to 10 pf.
Let's say the rise time will be 5 RC time constants.
The rise time might be around 100 ns. That's not a problem. |
|
|
|