There you go... I was feeling benevolent...
You could do this with a 10F series chip... 90 words are not exactly taxing a 12F... (actually, thinking about it, you could do this with a NE555 configured in monostable mode)...
Untested - but it compiles and it's a start to check the logic...
Code:' ' PIC Defines ' ----------- @ DEVICE pic12F675, INTRC_OSC_NOCLKOUT ' System Clock Options (Internal) @ DEVICE pic12F675, WDT_ON ' Watchdog Timer @ DEVICE pic12F675, PWRT_ON ' Power-On Timer @ DEVICE pic12F675, MCLR_OFF ' Master Clear Options (Internal) @ DEVICE pic12F675, BOD_ON ' Brown-Out Detect @ DEVICE pic12F675, CPD_OFF ' Data Memory Code Protect @ DEVICE pic12F675, PROTECT_OFF ' Program Code Protection ' ' Define Hardware ' --------------- InputTrigger var GPIO.0 ' Input normally LOW, goes HIGH to Trigger InputReset var GPIO.1 ' Input normally LOW, goes HIGH to RESET OutputLine var GPIO.2 ' Normally LOW, goes HIGH when triggered ' ' Define Variables ' ---------------- DelayTick var Byte ' 100mS Tick Counter ' ' Initialise PIC ' -------------- Reset: TRISIO=%00000011 ' Preset I/O CMCON=%00000111 ' Disable Comparators ANSEL=%00000000 ' Disable ADC DelayTick=0 ' Reset Counter Low OutputLine ' Everything RESET ' ' Main Program Loop ' ----------------- Loop: ' ' Test for RESET ' -------------- While InputReset=1 ' Just wait here if RESET DelayTick=0 ' Reset Counter Low OutputLine ' Reset Output Wend ' ' Test for Trigger ' ---------------- If InputTrigger=1 then ' Test for Trigger High OutputLine ' Enable Output DelayTick=1 ' Arm Counter Goto Loop endif ' ' Timeout Counter ' --------------- If DelayTick>0 then DelayTick=DelayTick+1 ' Count Time Pause 100 ' Waste 100mS If DelayTick>201 then goto Reset ' Reset at 20 Seconds endif Goto Loop ' End




Bookmarks