Help with Pic Delay Pulse code please


Closed Thread
Results 1 to 37 of 37

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    The output signal of the RF repeater is switched when the input signal is switched, but sometimes the received signal can be 'choppy' (Like any mobile radio signal, the signal strength varies wildly depending on terrain and the movement of the antenna)
    That doesn't equate to the new requirement as described... if for example you have had good reception for say 5 seconds and then your signal starts to break up, because the DelayTime has elapsed the repeater will disengage immediately. You should have your Repeater timeout only START at the end of reception and if reception is re-enabled within the timeout period, then you simply go back to the start with the Transmitter still holding on. That way, as long as reception re-occurs within the 1 Second Time-Delay the repeater is still held on... so this now becomes (in a simplified form)...

    Loop:
    If InputTrigger=0 then OutputLine=0
    If InputTrigger=1 and TimeDelay>1Second then OutputLine=1
    Goto Loop

    You should also consider a secondary feature... an additional timeout to disengage the Transmitter regardless if it has been held on for say 15 minutes continuously (in case of some localised lock-up in the repeater receiver from it's own transmitter).

  2. #2


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Melanie View Post
    That doesn't equate to the new requirement as described... if for example you have had good reception for say 5 seconds and then your signal starts to break up, because the DelayTime has elapsed the repeater will disengage immediately. You should have your Repeater timeout only START at the end of reception and if reception is re-enabled within the timeout period, then you simply go back to the start with the Transmitter still holding on. That way, as long as reception re-occurs within the 1 Second Time-Delay the repeater is still held on... so this now becomes (in a simplified form)...

    Loop:
    If InputTrigger=0 then OutputLine=0
    If InputTrigger=1 and TimeDelay>1Second then OutputLine=1
    Goto Loop

    You should also consider a secondary feature... an additional timeout to disengage the Transmitter regardless if it has been held on for say 15 minutes continuously (in case of some localised lock-up in the repeater receiver from it's own transmitter).

    I thought it a good idea to just keep the one second delay too, but for some reason it seems to have caused Dave a problem not to have. You make a very good point regarding a good signal transitioning into a bad one over the course of one reception period, and that alone probably justifies keeping the delay on all transmissions.

    Often you hear amateur operaters stop transmitting to check if they still have the repeater control, which indicates that the TX signal is still strong enough to keep the repeater's RX output switch engaged

    The tx/rx lockup prevention is already taken care of by the rx/tx frequency offset, which is 0.6MHz for the 2m band (144-146 MHz) and 1.6Mhz (or 7.6MHz) offset for the 70cm band (430-440MHz approx)

  3. #3
    Join Date
    Oct 2007
    Posts
    35


    Did you find this post helpful? Yes | No

    Default

    Hi Melanie and Chris

    Many thanks for all your input,
    Yes your final configs are about right, both of you added points I hadn't thought of,

    (The repeater controller is for a small low power unit, the timeout/lockup watchdogs are incorporated in the main radios, so are not required.)

    1. InputTrigger goes Low... this causes OutputLine to go Low
    2. If the InputTrigger pulses at anytime that InputTrigger is Low < 1 Second then OutputLine is held on by DelayTime
    3. If the InputTrigger => 1 Second then DelayTime is Terminated
    4. And I want a Blinky for diagnostic.
    5. If possible an led to display whether the delay has been triggered, (this would be an added diagnostic function and a help when setting the rx radio up)

    It needs to self monitor for InputTrigger pulses for as long as InputTrigger is Low, and self cancel if InputTrigger stops pulsing.

    Hope this is makes sense,

    Cheers
    Dave..

  4. #4
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    OK, it's not the way I would do it... but I can see your logic...

    As long as InputTrigger keeps pulsing, the Delay Timer keeps resetting back to the start as long as the Delay Time hasn't already expired, during this time OutputLine will be kept Low. If the Delay Time has expired then on the first occasion InputTrigger goes High, then so does OutputLine.

    You have a 2Hz Blinky (which stops whilst you do an Input Reset).

    And you have a DelayLED for your Diagnostic purposes...
    Attached Files Attached Files

  5. #5
    Join Date
    Oct 2007
    Posts
    35


    Did you find this post helpful? Yes | No

    Default

    Hi Melanie

    Many many thanks for the code,
    I have given it a try, (like the diagnostic leds)
    Just a small thing,
    Can you tell me where the hang delay value is, and for some reason I get a delay nearly all the time, even after a 30 sec TriggerInput. Any ideas..??

    Apart from that its just what I was looking for.


    Thanks again,
    Cheers
    Dave...

  6. #6
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    Don't know what you're doing... I just breadboarded to test what I wrote and it works as expected. The DelayLED goes out if InputTrigger is constantly ON (solid ON) for 1 Second (that's active pulled LOW). If InputTrigger fluctuates, then DelayLED will be on all the time. You got AC coming down the line into InputTrigger? You forgot you need external Pull-Up's on the InputReset and InputTrigger?

    The Delay value is one of the two Constants defined at the start. Change that to change the Timeout.

  7. #7
    Join Date
    Oct 2007
    Posts
    35


    Did you find this post helpful? Yes | No

    Default

    You don't know whats going on?? I wish I knew..

    Sorry to be a pain, But this is doing my head in.....
    It must be something silly Im doing,

    I have blown it to a second pic in case it was faulty,
    I have checked for any mains hum or Rubbish on the input/output lines, all seem good.

    I have pullup/pulldown resistors, caps on power rails etc,
    mmmmm what pullup resistor values do you suggest,,?? I have 4k7 and 10k,,, are these to high, ?? (they seem to work elsewhere)
    The 8 pin pics seem to be a bit touchy I find,, what am I doing wrong.

    When it is in standby (no i/p) the led is on and the heartbeat is flashing,
    When I give an i/p of 30 seconds the led go's off and then on after 1 second,
    I get a o/p delay of 5 seconds, and sometimes 10 seconds.

    The blinky works fine and it resets any delay when called.

    I have tested it with a chattering i/p and found it sometimes it drops out instantly, and other times it can hang for anything up to a 45 or more seconds.
    (I locked it up playing oops, it took 2 mins to drop out)

    I have run it up out of the unit (as its on a sub board) to eliminate RF etc,

    The only thing I keep going back to is the resistors,,,
    By the way the i/p is being driven via an opto isolator (it seems to be a clean 5v to 0v switch)

    Cheers
    Dave..

  8. #8


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by g7jiq View Post
    You don't know whats going on?? I wish I knew..

    The only thing I keep going back to is the resistors,,,
    By the way the i/p is being driven via an opto isolator (it seems to be a clean 5v to 0v switch)

    Cheers
    Dave..
    Dave, do you really need to invoke the WDT ?
    Also, I have had problems with the MCLR define (in MPLAB, not picbasic) working inversely. When set to off it needed a pullup ! Bizarre


    Chris

Similar Threads

  1. 16F628A - Stops if release power switch.
    By dene12 in forum General
    Replies: 16
    Last Post: - 14th February 2009, 08:57
  2. Making Program Code Space your playground...
    By Melanie in forum Code Examples
    Replies: 15
    Last Post: - 19th July 2008, 09:26
  3. Help writing pic program with i/p o/p hold delay
    By g7jiq in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 27th May 2008, 22:58
  4. Pic driven digital audio delay
    By skimask in forum Off Topic
    Replies: 12
    Last Post: - 19th April 2007, 21:42
  5. Memory Space of the PIC16F84...
    By Tear in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 1st July 2005, 20:55

Members who have read this thread : 0

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