pulsin help on 12v pulse

juve021

Member
Hi all, wondering if you could help me out. I am trying to add a "chirp/beep" on door lock to my car. What I am doing is using an 08M to detect the flashing of the parking lights. The lights flash once upon locking. I figure the easiest way to do this using an AXE is to use PULSIN and detect the flashing only when the engine is in off state. For the off state, I am just going to power the picaxe using a time decaying cap/res circuit and have it active for say 30 seconds after the ACC is turned off.

I was wondering if someone could provide some example code about the PULSIN though. Not sure if I could just use it in a loop to keep on detecting input or maybe use an interrupt? Thanks in advance.
 

1968neil

Senior Member
Try this, should start you on the right track.
do remember tho' that you can't put 12 v directly into the chip 5v is the max so some sort of voltage reduction will be required.
The code below is just my interpretation of your requirements, hope it meets your needs.
Regards
Neil



Code:
Symbol ignition = pin3
Symbol lights = pin4



Softstart:

pause 1000  'give the chip time to startup properly


Main:                         ' routine to read ignition on or off

if ignition = 1 then flash  
pause 500                  
goto main                  

Flash:                         ' routine to see if lights flashed
if lights = 1 then chirp	' if they flashed play a tune	
'	pause 250 			' wait 250ms

goto main

chirp:

	tune 0, 1,($D6,$D0)     ' output two tones (chirp)
	pause 2000 			' wait 2 seconds
	goto main
 
Last edited:

juve021

Member
wow thanks for the quick response...

simpler than I thought...thanks this will work or I can tweak it a bit!

cheers!
 
Top