PULSOUT emulating phase shift


Closed Thread
Results 1 to 5 of 5

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Hi again Leigh,

    Sorry, my other project took me longer than expected. Now, back to yours.

    Not to worry, this is very doable. But, it has to be done with a little assembly language and some interrupts. The main reason I took you in the "Capture" direction for the RPM in <a href ="http://www.picbasic.co.uk/forum/showthread.php?s=&threadid=366">the previous thread</a> was to keep the interrupts free for this phase of it, and also to keep the PIC from wasting time on Pulsin measuments that don't allow anything else to happen at the same time.

    Essentially, you just need to take the signal that is currently going to the CCP (RC2) and also connect it to the INT pin (RB0).

    Then we'll first set INTEDG to 1 so that it creates an interrupt on the rising edge. In the interrupt, we'll start TMR0 with a preloaded value that gives the required delay. This value may need to be adjusted from what your table gives in order to account for the interrupt delay, but should be easy enough. Then when TMR0 overflows, another interrupt is generated. This time it turns ON the output and sets INTEDG to 0 to catch the falling edge of the pulse. On the next interrupt it starts TMR0 again for the "Post Delay", and when the TMR0 overflows again, it turns the output off, sets INTEDG back to 1 in prep for the next pulse.

    There are a few other things to account for, one being, not interferring with the RPM reading since an interrupt will occur exactly when you have to start the capture process, but this is also doable.

    But, for now I'd like to see your table, so I can get a feel for the minumum and maximum delays. Since I know Squat about engines, I can't even guess at what they might be.

    Of course, if you wanted to show the whole program, it would be helpfull too. Apparently, you've made some progress (changes) in other areas as well.

    Best regards,
    &nbsp;&nbsp;&nbsp;Darrel
    Last edited by Darrel Taylor; - 15th May 2004 at 21:05.

Similar Threads

  1. 3 phase supply detector challenge
    By BobEdge in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 15th May 2009, 07:54
  2. Smart Star (how to use shift registers)
    By mackrackit in forum Code Examples
    Replies: 3
    Last Post: - 30th November 2008, 20:06
  3. Replies: 6
    Last Post: - 30th October 2006, 03:37
  4. Output PIC module
    By freelancebee in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 12th September 2005, 20:10
  5. Help Quick Need to make code smaller
    By Programmednew in forum mel PIC BASIC Pro
    Replies: 41
    Last Post: - 25th January 2005, 03:46

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