Pulsin problem?


Closed Thread
Results 1 to 4 of 4

Thread: Pulsin problem?

Hybrid View

  1. #1
    Join Date
    May 2009
    Posts
    4

    Default Pulsin problem?

    Hi,
    I'm using pulsin to measure the high time of a squarewave created by the engine control unit to drive the tachometer. I'm using a 16F877a with a 20MHz osc.

    At 1000 rpm or 16.667Hz, my LCD screen shows 950-1050 (hightime is around 1500counts). All is well, I thought.
    So I rev the engine to 2000rpm, my screen only shows 1333, and 1500 at 3000rpm. hightime is around 1079 at 3000rpm, it should be 750.

    Checking the same wire with the frequency function on my multimeter, it reads 32-33Hz at 1000rpm and 66Hz at 2000rpm. This wire should have a squarewave at the engine speed. So my multimeter is reading twice this rate but it at least proves that the output is linear.

    I think the problem is with pulsin. I was previously using count to measure the number of rising edges in 500ms and multiplying this by 60. This worked but it was slow to update and the resolution wasn't as good as I wanted it.

    Any thoughts on why the PIC isn't interpreting the wave properly?

  2. #2
    Join Date
    Dec 2005
    Posts
    1,073


    Did you find this post helpful? Yes | No

    Default

    How square are the pulses?

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


    Did you find this post helpful? Yes | No

    Wink

    Hi,

    here, you are supposing your ECU Outputs a perfectly square wave ... is it real ???

    At 1000 rpm or 16.667Hz, my LCD screen shows 950-1050 (hightime is around 1500counts)
    ??? 1500 counts are 3 ms @ 20 Mhz ... 6ms ( square wave ) per rev is ... 10 000 rpm !!! ... not 1000.

    you have a calculation error somewhere !!!

    let's say 15000 counts ...

    60 000 000 / 2 / 2 / 15000 = 1000

    60 000 000 is 60 Million µs in a minute
    2 is for square wave ( you measure half duration )
    2 is for 2 pulses per rev ( matches your DVM result ... hé,hé )
    15000 is Pulsin result.

    also see DIV32 for 60 E6 ( or 15 E6 ! ) value use ...


    You'd better use " interrupts on edge " that would measure the full cycle ( High + Low parts of the signal ) regardless of the duty factor of your pulse ...

    see " DT Instant interrupts " for that ... works great ++ aboard my Honda lawn tractor ( lol )

    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
    May 2009
    Posts
    4


    Did you find this post helpful? Yes | No

    Default

    Yeah, I have no idea how the pulses look nor do I have equipment to see it.

    Acetronics, you are right about the hightime, it is 15000, I forgot I was looking at the number divided by ten on screen.

    I'll try using interrupts, it will work that way but it'll take me a while to get my head around it.

    Thanks.

Similar Threads

  1. Replies: 17
    Last Post: - 12th April 2014, 02:17
  2. Pulsin 16F819 problem
    By rekcahlaer in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 11th April 2007, 13:52
  3. pulsin followed by serin2 problem
    By RSSHARPE in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 18th September 2005, 09:50
  4. a problem RF Signal with PULSIN
    By muskut in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 22nd July 2005, 16:42
  5. Replies: 11
    Last Post: - 13th July 2005, 19:26

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