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


Results 1 to 21 of 21

Threaded View

  1. #18
    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
    With a terrible hiccup in the 12kHz signal, I have to test the the frequency with:

    If (Counter > 1) then

    So as long as the PIC counts anything over a 1kHz, the relay works properly. What a crappy 12kHz signal from Mach3. I hope this doesn't reflect the quality of their stepper motor control. I guess I'll find out.

    Hopefully, they the explanation is that they had to compromise the 12kHz signal for better control over the stepper motor signals.
    I'm not familiar with the Mach3 product but it sounds like it needs to be corrected as it's not offering a correct output. If you need to use it you could always try this in your code:

    Code:
    working var byte
    working = 2
    
    MAIN:
    count chrgpmp, 1, cntcp ' Count freq. on B0, Mach3's 12kHz
    if (cntcp >= 11) and (cntcp <= 13) then ' Freq. must be between 11 & 13kHz
    working = 2
    else
    if working > 0 then      ' Stops working variable from rolling from 0 to 255!
    working = working - 1
    endif
    endif
    if working >0 then
    lptports = 1
    else
    lptports = 0
    endif
    
    goto main
    This will make a double check every time there is a 'hiccup' in the 12kHz signal. Of course if this doesn't correct it you could always increase the "working" variable where it is defined and also in the third line of the above code.

    Hope this helps

    Rob
    Last edited by Rob; - 9th September 2007 at 13:18.

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