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.
-Adam
Greg Hastings wrote:
{Quote hidden}>
> 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