Shop OBEX P1 Docs P2 Docs Learn Events
Prelinary Propeller tachometer results — Parallax Forums

Prelinary Propeller tachometer results

yarisboyyarisboy Posts: 245
edited 2010-08-19 04:37 in Propeller 1
I used the Frequency synthesis ver 1.1 by Beau Schwabe and set the constant to 200 HZ. The oscilloscope result from my ECM simulator agreed on time base. I used Jon Williams jm_freqin.spin as a base for a tachometer output. For a four cylinder four stroke engine we were looking for 6000 RPM. The Object returned 5997 RPM. By contrast the digital automotive tachometer from Fry's electronics returned 5,840 RPM. I "calibrated" my old BS2 tachometer using the cheapy auto tach so the older tachometer is off more that the traditional 2% at full scale. Oh thank heaven for 5 MHz crystals. I'm finally getting the hang of modifying OBEX software for my purpose.
Now, onward to serial display drivers. I meant to say Preliminary in the title.

Comments

  • BluhairBluhair Posts: 7
    edited 2010-08-18 21:10
    Could you please post your code. I have been working on a similar project.

    Thank You
  • yarisboyyarisboy Posts: 245
    edited 2010-08-19 04:37
    The other files in the Zip downloads from OBEX remain unchanged.
    '' =================================================================================================
    ''
    '' File....... modified from jm_freqin_demo.spin (by Stan Cloyd)
    '' Purpose.... Process signal from OBD2 tach signal through opto-isolator to pin 0 of the Propeller multi-processor
    '' Original Author..... Jon "JonnyMac" McPhalen (aka Jon Williams)
    '' Copyright (c) 2009 Jon McPhalen
    '' -- see below for terms of use
    '' E-mail..... jon@jonmcphalen.com
    '' Started.... 09 JUL 2009
    '' Updated.... 10 JUL 2009
    '' Modified .. 19 August 2010
    '' =================================================================================================


    con

    _clkmode = xtal1 + pll16x
    _xinfreq = 5_000_000


    con

    #0, CLS, HOME, #8, BKSP, TAB, LF, CLREOL, CLRDN, CR ' PST formmatting control


    obj

    fc : "jm_freqin"
    term : "jm_txserial"


    pub main | f

    fc.init(0) ' freq cntr on p0

    term.init(30, 115_200) ' start terminal
    waitcnt(clkfreq/10 + cnt)
    term.tx(CLS)

    repeat
    term.str(string(HOME, "revs: "))
    f := fc.freq ' get frequency
    if f > 0 ' valid?
    term.dec(f*30/10) ' print whole part, 30 constant is for 4-cylinder, four-stroke ICE.
    term.tx(".")
    term.dec(f*30//10) ' print fractional part
    term.str(string(" rpm", CLREOL))
    else
    term.str(string("???", CLREOL))
    waitcnt(clkfreq + cnt)


    {{
    *****************************************
    * Frequency Synthesizer demo v1.2 *
    * Author: Beau Schwabe *
    * Copyright (c) 2007 Parallax *
    * See end of file for terms of use. *
    *****************************************
    Original Author: Chip Gracey
    Modified by Beau Schwabe
    Modified by Stan Cloyd 8/19/2010
    *****************************************
    }}
    {
    Revision History:
    Version 1.0 - original file created

    Version 1.1 - For Channel "B" there was a typo in the 'Synth' object
    The line that reads...
    DIRB[Pin]~~ 'make pin output
    ...should read...
    DIRA[Pin]~~ 'make pin output
    Version 1.2 To generate an ECM signal for 6000 RPM, Output must be amplified to 0-12 volts for scale
    and should be opto-isolated to protect your other Prop.
    }
    CON

    _CLKMODE = XTAL1 + PLL16X
    _XINFREQ = 5_000_000


    Pin = 0

    Frequency = 200 '200 Hz from the OBD port of an automotive ECM with a four-cylinder, four stroke ICE represents 6000 RPM tachometer readout.

    VAR

    OBJ
    Freq : "Synth"

    PUB CTR_Demo

    Freq.Synth("A",Pin, Frequency) 'Synth({Counter"A" or Counter"B"},Pin, Freq)

    repeat 'loop forever to keep cog alive

    DAT
    {{
    ┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
    │ TERMS OF USE: MIT License │
    ├──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
    │Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation │
    │files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, │
    │modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software│
    │is furnished to do so, subject to the following conditions: │
    │ │
    │The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.│
    │ │
    │THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE │
    │WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR │
    │COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, │
    │ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. │
    └──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
Sign In or Register to comment.