Help with Pic Delay code mod please


Closed Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2007
    Posts
    35

    Default Help with Pic Delay code mod please

    Hi all (again)

    I big thanks to all that have help me in the past,
    But I have a small problem I hope someone can put me straight with.

    Below is my code I have had running for some time with no problems,
    What it does is to allow an input to output with a delay on the output when the input is removed,
    What I would like to add to this is if the input trigger is longer than say 1 second the output is triggered as before but doesn't have any delay,
    If the input has smaller pulses of say less than 1 second the delay is as before.

    I hope this makes sense,
    Any ideas...?

    Many thanks to all ....

    ************************************************** *************

    'G7JIQ MICRO LINK REPEATER
    'PIC 12F675
    'Internal RC clock
    '
    ' 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.5 ' Input normally HIGH, goes LOW to Trigger
    InputReset var GPIO.2 ' Input normally HIGH, goes LOW to RESET
    OutputLine var GPIO.0 ' Normally HIGH, goes LOW when triggered
    Led var GPIO.1
    '
    ' Define Variables
    ' ----------------
    DelayTick var Byte ' 100mS Tick Counter

    '
    ' Initialise PIC
    ' --------------
    Reset:
    TRISIO=%00100100 ' Preset I/O
    CMCON=%00000111 ' Disable Comparators
    ANSEL=%00000000 ' Disable ADC
    DelayTick=0 ' Reset Counter
    high OutputLine ' Everything RESET


    ' pause 4000

    ' Main Program Loop
    ' -----------------
    Loop:
    '
    ' Test for RESET
    ' --------------
    While InputReset=0 ' Just wait here if RESET
    DelayTick=0 ' Reset Counter
    high OutputLine ' Reset Output
    Wend
    '
    ' Test for Trigger
    ' ----------------
    If InputTrigger=0 then ' Test for Trigger
    low OutputLine ' Enable Output
    DelayTick=1 ' Arm Counter
    'Goto Loop
    endif
    '
    ' Timeout Counter
    ' ---------------
    If DelayTick>0 then
    DelayTick=DelayTick+1 ' Count Time
    Pause 60 ' Waste 100mS
    If DelayTick>50 then goto Reset
    ' 50 = 5 sec
    ' 100 = 10 sec
    ' origanly set at 201 Reset at 20 Seconds
    endif
    Goto Loop

    '
    End

  2. #2
    Join Date
    Oct 2007
    Posts
    35


    Did you find this post helpful? Yes | No

    Default Can anyone please help me,

    Can anyone please help me with my previous post.
    Any takers please...

Similar Threads

  1. Reading in Manchester code
    By brid0030 in forum Code Examples
    Replies: 0
    Last Post: - 10th March 2009, 21:55
  2. 16F628A - Stops if release power switch.
    By dene12 in forum General
    Replies: 16
    Last Post: - 14th February 2009, 07:57
  3. Making Program Code Space your playground...
    By Melanie in forum Code Examples
    Replies: 15
    Last Post: - 19th July 2008, 08:26
  4. pic to pic ir link versus wired link : help please anyone
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 30th May 2008, 21:01
  5. assembly in Pic
    By lerameur in forum Off Topic
    Replies: 11
    Last Post: - 1st May 2008, 20:06

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts