16F877A won't keep relay on 100% of the time


Closed Thread
Results 1 to 21 of 21

Hybrid View

  1. #1
    Join Date
    Feb 2005
    Location
    Essex, UK
    Posts
    94


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by coyotegd View Post
    I have this assembler code at the start of my program:

    @ DEVICE HS_OSC, WDT_OFF, LVP_OFF, BOD_OFF, PWRT_ON, PROTECT_OFF

    I'm quite certain the "WDT_OFF" turns the Timer off.
    Yeah that's right, it does turn the tmier off.


    The "HS_OSC" is my change because I have a 20Mhz xtal, and yes, I have "OSC 20" in my "PIC Basic" code.
    It still sounds to me like the PIC is resetting or some other code elsewhere in your program is causing the output to go low on the pin you are using. Just for arguments sake, create a new program with just this code and try it out.


    The other line items are "Boiler Plate" I've found looking around the Forum.
    I've never heard the term "boiler plate" before so I'm not quite sure what you mean?

    Cheers

    Rob

  2. #2


    Did you find this post helpful? Yes | No

    Default

    Try removing the relay and use an LED with a resistor. If the LED works, your code is OK and the relay coil is the culprit. I've had interference problems with small vibrating motors located very close to the PIC.

  3. #3
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Lightbulb Some ideas ...

    Hi, Coyote

    1) Did you try to use HIGH Portx.y ...

    I noticed many times it is much more reliable than Portx.y = 1 in disturbed circuits ...

    2) @ 20 Mhz, you also could try PULSIN instead of count ( as it is a square wave )... nominal result will be 20 ... and there will be a little less "rollover" issues ...

    3) The ideal way would be to use the "capture" feature of the CCP modules ... in a '877 there are two modules !! ...

    Darrel's instant interrupts are ... the easy way ... to make that. And it takes much, much, much less CPU time ...

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  4. #4
    Join Date
    Feb 2005
    Location
    Essex, UK
    Posts
    94


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Acetronics View Post
    Hi, Coyote

    1) Did you try to use HIGH Portx.y ...

    I noticed many times it is much more reliable than Portx.y = 1 in disturbed circuits ...
    That's interesting! I learn something new every day! Nice one!

    Cheers

    Rob

Similar Threads

  1. First time with external oscillator - 16F877a Not working
    By financecatalyst in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 15th October 2009, 17:14
  2. I don't understand this code!
    By Russ Kincaid in forum mel PIC BASIC Pro
    Replies: 46
    Last Post: - 13th February 2008, 02:55
  3. Serial Relays
    By tazntex in forum General
    Replies: 3
    Last Post: - 17th May 2007, 17:42
  4. Serout2/serin2 Pbp Problem
    By SOMRU in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 11th December 2006, 19:55
  5. Timer in real time
    By martarse in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 29th July 2005, 14:24

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