Searching \ for 'Detecting a Pulse' in subject line. ()
Help us get a faster server
FAQ page: www.piclist.com/techref/index.htm?key=detecting+pulse
Search entire site for: 'Detecting a Pulse'.

Truncated match.
'Detecting a Pulse'
2000\06\12@181418 by

<x-flowed>I am playing around with my cars turn signal.  When the turn signal is on I
want to be able to just read an input and get a 1 on one of the pics input.

Is there a chip that can do this?  It is safe to assume that the pulse width
can be as large as 3 seconds.

If there is no such chip I plan to put some code in an timmer/interupt
handler which checks for the pulse.  It will just set a variable depending
on if it detects a pulse.  If it hasnt seen the pulse in a while it will
just clear a variable.

Has anyone done this?  Schematics and web links would be a big help thanks.

Greg

________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com

</x-flowed>
You could do something fairly simple:

Hook a diode from the signal into a capacitor and resistor in parallel (other
ends connected to ground).  Pick a large cap, and a large resister such that
when the 12v from the turn signal charges the cap, it takes 3 seconds to
discharge through the resister.

Take that and hook up another diode which leads into a resister which then goes
into the PIC pin (protected by a 5.1v zener, ideally).

When the cap discharges to around 3-4v, the pin will go low.  Use a pin with the
schmidt trigger (porta.4) for better readings.

Behold the ascii art:

Turn Signal -----|>|---+---+---|>|---/\/\/---+--- PIC Input
|   \                 |
+--)|--+   /       +---|>|---+
|          \       | Zener
|          /       |
Ground ---------+----------+-------+

Otherwise you could make a routine to check the input a few times a second.  It
depends on how cost-sensitive your application is.  This makes programming much
easier, but you also have to include 4 extra parts (you'd need the zener and
resister anyway) and that might cost you as much as \$0.05 per unit in quantity
(oh the horror!).

Or you could use a 12c508... ;-)

Anyway, I hope this gives you some ideas.

Greg Hastings wrote:
{Quote hidden}

On Mon, 12 Jun 2000, Greg Hastings wrote:

> I am playing around with my cars turn signal.  When the turn signal is on I
> want to be able to just read an input and get a 1 on one of the pics input.

This shouldn't be a problem.  Just run the lamp signal into a PIC input
pin thru a 100K or larger resistor to limit the current.  With a 100K
resistor, the current will be limited to 100uA (did I get that decimal in
the right place?), which is well below the 250-400uA rated capacity of the
PORTB weak pull-up resistors even if you assume a 15V input.  This is what
I (and many others) do with
RS232 inputs to a PIC.

> Is there a chip that can do this?  It is safe to assume that the pulse width
> can be as large as 3 seconds.

Most, if not all of them.

> Has anyone done this?  Schematics and web links would be a big help thanks.

Not (yet) specifically with a turn signal line, but with RS232 voltages,
yes.  50K Ohm resistor works well with +/- 10V swings.

Dale
---
The most exciting phrase to hear in science, the one that heralds new
discoveries, is not "Eureka!" (I found it!) but "That's funny ..."
-- Isaac Asimov

From the left and right outputs (wires going to lights) take a tap through a
diode - combine these isolated inputs and pass them through a small filter
circuit then in to the PIC via a level shifting transistor (inverts signal).
The filter reduces current demand and does hardware de-bouncing for you (may
have to try a few values to suit your indicators).
Use a fixed font (like courier) to view this diagram -
1K
/--/\/\/\--+5V
1N4004                                         |
Left ------|\------\                                    |------ PIC
|/      |                                    /
|       1K5               10K      |/
Right -----|\------\-----/\/\/\/\/\----\---/\/\/\/\---|   BC337
|/                          |              |\
4.7uF ===              _\|
---               |
|                |
|                |
0V -----------------------------------/                \------ 0V

Bye.

{Original Message removed}
What you plan to do sounds reasonable to me. Don't have the signal
interrupt on an edge but instead set a timer to interrupt at a rate much
higher that the pusle wide expected and then sample the status of the pulse
input. You could average the sample to smooth your data; that is, say you
must  receive at least three HIGHS in a row so you don't false.

Phil

On Monday, June 12, 2000 5:03 PM, Greg Hastings [SMTP:ghpicHOTMAIL.COM]
wrote:
> I am playing around with my cars turn signal.  When the turn signal is on
I
> want to be able to just read an input and get a 1 on one of the pics
input.
>
> Is there a chip that can do this?  It is safe to assume that the pulse
width
> can be as large as 3 seconds.
>
> If there is no such chip I plan to put some code in an timmer/interupt
> handler which checks for the pulse.  It will just set a variable
depending
> on if it detects a pulse.  If it hasnt seen the pulse in a while it will
> just clear a variable.
>
> Has anyone done this?  Schematics and web links would be a big help
thanks.
>
> Greg
>
> ________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com

More... (looser matching)
- Last day of these posts
- In 2000 , 2001 only
- Today
- New search...