Help with Pic Delay Pulse code please


Closed Thread
Results 1 to 37 of 37

Hybrid View

  1. #1
    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..

  2. #2


    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

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


    Did you find this post helpful? Yes | No

    Default

    Make a girl work why don't you!

    1. I downloaded the Repeater.TXT file from the forum and renamed it Repeater.BAS

    2. I compiled it with PBP 2.46

    PBP -p12F675 Repeater -v

    3. I drew the test schematic and posted it here

    4. I breadboarded it

    5. I tested it

    6. I documented it



    It works as expected thus...

    A. When SW2 is pressed OUTPUTLINE illuminates along with DELAYLED.

    B. If SW2 is released within one Second, DELAYLED and OUTPUTLINE still remain illuminated until one Second expires - then both go out.

    C. If SW2 is held beyond one Second, DELAYLED goes out at the one Second count, but OUPUTLINE remains illuminated for as long as SW2 is held. The instant SW2 is released OUTPUTLINE goes out.

    D. If SW2 is pulsed within it's initial one Second period, both DELAYLED and OUTPUTLINE remain illuminated (and the one Second count keeps being reset) until the pulsing stops. Thereafter either condition B or C will apply.

    E. If SW1 is pressed, all LEDS go out - including BLINKY until SW1 is released.

    F. BLINKY tells you you've paid your electricity bill unless condition E applies.



    If yours don't work like that then...

    1. Breadboard my test schematic and run it...

    2. Check your Supply +5v is good... (you don't need anything on your MCLR pin unless your programmer isn't programming the CONFIGS properly).

    3. Check your INPUTTRIGGER with a scope... is it waving about keeping the DELAYTIME (DELAYLED) running (per condition D above)? This is the ONLY thing that I can think of immediately that would cause your PIC to malfunction the way you describe.
    Attached Images Attached Images  

  4. #4
    Join Date
    Oct 2007
    Posts
    35


    Did you find this post helpful? Yes | No

    Default

    Hello again,

    Sorry to put you to all this, Its very much appreciated.

    I have run up the circuit as your diagram,
    I think I may be on the right trail of the problem.
    As you have it it does nothing,
    I have to add a pullup 4k7 to the MCLR pin, like on the 16F84 ( I have always done this)

    It looks like my programmer isn't set correctly (as you rightly said)
    Looks like we've found it... (I do hope this is it)

    My programmer is a K149-BC USB programmer, (don't know if you know of it)

    I have fuse settings, I don't really know what they do, and the help doesn't really help.

    My fuse edit screen has the following.

    WDT this is enabled
    MCLRE this is disabled ( could it be this....!!!!)
    Code protect ROM this is disabled
    Bandgap this is set to highest
    PWRTE this is enabled (I know what this does)
    BODEN this is enabled
    Code Protect EEP this is disabled (I know what this does)
    Oscillator INTOSC IOGP4 IOGP5 (I know what this does)

    Any ideas on the other ones,
    I have programmed 16F84's, 16F627's etc all set as default, and these have been fine.


    Thanks again,
    Cheers
    Dave..

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


    Did you find this post helpful? Yes | No

    Default

    I can't answer questions on your programmer as I don't have one.

    Your CONFIG settings should match those preset into the program, but whether your programmer is actually programming them is another qustion.

    If MCLR needs a pull-up, then the CONFIGS sure don't match (or yor PIC is broke)... it could be there's another tick-box in your software for your programmer that needs activating. My software for example has the ability to program the PIC and leave the CONFIGS untouched unless I've set it on another screen. This also means that GPIO4 could have OSC coming out of it instead of it being used for I/O.

    Worst case scenario is I can send you my PIC, but it means you can't make changes if your programmer is misbehaving.

  6. #6
    Join Date
    Oct 2007
    Posts
    35


    Did you find this post helpful? Yes | No

    Default

    Hi Melanie,

    Some very good news, I managed to get it sorted,
    It works superb,

    The problem I had was two fold,
    The first one was the configs fuse settings, It now works without the 4k7 pullup resister on the MCLR pin. (just as you said)

    It would then work in the breadboard fine but not in my circuit,

    To cut a long story short,
    When I lifted the output pin and dropped an led on it, it worked fine,

    So.... I found that,

    The pic's output drives an opto and led in series, with a 470 ohm to the 5v rail.
    The pic also feeds an input to another pic, (which drives my lcd)
    Somehow there wasnt enough current to drive the circuit even tho there should have been,
    so I fitted another opto isolator as a buffer and this sorted it.

    What a run around,

    Many many thanks for all your help and patience, your a star...

    Cheers
    Dave...

  7. #7
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    2 rules in this forum:
    #1. Never doubt Melanie.
    #2. Go back to Rule #1
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

Similar Threads

  1. 16F628A - Stops if release power switch.
    By dene12 in forum General
    Replies: 16
    Last Post: - 14th February 2009, 07:57
  2. Making Program Code Space your playground...
    By Melanie in forum Code Examples
    Replies: 15
    Last Post: - 19th July 2008, 08: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, 21:58
  4. Pic driven digital audio delay
    By skimask in forum Off Topic
    Replies: 12
    Last Post: - 19th April 2007, 20:42
  5. Memory Space of the PIC16F84...
    By Tear in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 1st July 2005, 19: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