Capture


Closed Thread
Results 1 to 6 of 6

Thread: Capture

Hybrid View

  1. #1
    G8RPI's Avatar
    G8RPI Guest


    Did you find this post helpful? Yes | No

    Default

    Hi,
    Your fomula is correct. Pulsein works well for slower speed signals (6ms is slow) at 500RPM you would have to count 20 pulses for 5% (25RPM) resolution This would take 2.4 seconds between readings or 1.2 s for 50RPM resolution. Measuring the period takes only 0.12s with the full 16bit (0.15RPM) resolution of pulsein.
    Below is some code I wrote as part as a gas turbine (jet) engine controller.
    Pulsein_max colud de reduced to 15000 (0.15 seconds) for your 500RPM lower limit. This stops the program waiting for a pulse (default is 65 seconds) when the engine is not turning.
    HTH,
    Robert G8RPI.

    'Start sequencer for gas turbine engines
    'PIC16F877, XT, 4MHz
    'Robert Atkinson G8RPI 29/01/03

    'INPUTS------------------------------------------------------------

    'HP Tacho input 70Hz = 100%

    HPTACH VAR PORTB.0 'HP TACHOMETER INPUT
    DEFINE PULSIN_MAX 41000 ' LIMIT MAXIMUM COUNT TIME TO 0.41S



    'VARIABLES-----------------------------------------
    HPRPM VAR WORD 'PERCENT HP RPM

    HPPW VAR WORD 'ACTUAL PULSE WIDTH HP TACHO

    '************************************************* *****************************

    GOTO MAIN 'JUMP PAST SUBROUTINES


    HPRPMCAP: 'RPM CAPTURE MODULE


    PULSIN HPTACH, 1, HPPW

    HPRPM = 35700 / (HPPW / 2) 'CALCULATION OF PERCENT BASED ON 2 POLE 4200 RPM = 100%
    '35700 USED DUE TO 16 BIT MATH LIMIT
    IF HPPW <400 OR HPPW >40000 THEN 'TRAP UNDER AND OVER PULSE WIDTHS
    HPRPM = 0
    ENDIF

  2. #2
    SlotH's Avatar
    SlotH Guest


    Did you find this post helpful? Yes | No

    Default

    I think I will have to stick to my first idea, in other words CCP.
    Found a great example :
    http://picbasic.com/resources/samples/x2/pbp/ccpx2.bas
    But I'm not really sure how it works and how do you divide #period with 60 ? I assume that the period i messured in seconds.
    *edit* Thanks for the great support, I feel a little dumb asking these questions.

Similar Threads

  1. mS Timer
    By whmeade10 in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 8th September 2020, 13:12
  2. Using hardware capture
    By Bruce in forum Code Examples
    Replies: 14
    Last Post: - 25th March 2012, 06:52
  3. Using CCP1 and CCP2 to measure instant fuel consumption
    By srspinho in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 20th September 2008, 16:50
  4. Measuring change of frequency with PIC
    By Aussie in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 19th July 2007, 02:47
  5. continious counting process (capture)
    By asynch in forum General
    Replies: 1
    Last Post: - 17th February 2006, 08:42

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