Shop OBEX P1 Docs P2 Docs Learn Events
pulsin command — Parallax Forums

pulsin command

TobiasTobias Posts: 95
edited 2006-12-03 00:01 in BASIC Stamp
I am using a truck speed sensor for my pulsin I not sure that my code is correct, I am trying to display the value in the debug terminal in mph. Your help will be greatly appreciated. Thank-You

Comments

  • ZootZoot Posts: 2,227
    edited 2006-11-30 16:31
    Can you post some code and/or a circuit?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST
  • TobiasTobias Posts: 95
    edited 2006-12-01 03:15
    Hey thanks alot for your responds, I discovered that this code, circuit works priddy good. am i using the right code,circuit?

    mph var word

    main:
    pulsin 8, 1, mph ' Get reading

    debug 2,1,1, "mph ", dec3 mph ' Display mph
    goto main ' around forever
  • ZootZoot Posts: 2,227
    edited 2006-12-01 03:37
    What is your pin 8 hooked up to in order to read the speedodometer output? Presuming that circuit works, your main loop is fine. You might want to put in some extra code to convert whatever the speedo is giving you (if you need to)

    Also, you are debugging a Word, which could have a lot more than 3 digits -- you might want to see the value of the whole variable during testing.

    mphk CON $100  ' some value for scaling mph to the right range
    mph var word
    
    main:
    pulsin 8, 1, mph ' Get reading
    
    mph = mph */ mphk
    
    debug 2,1,1, "mph ", dec5 mph ' Display mph
    goto main ' around forever
    

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST
  • TGTG Posts: 36
    edited 2006-12-02 19:31
    I am using a hall effect sensor to count teeth. Kind of like your project. On the hardware side, should I use a Cap in between the STAMP and the sensor? The signal will be around 1600Hz
  • Martin HebelMartin Hebel Posts: 1,239
    edited 2006-12-02 21:17
    As long as the output is conditioned for 5V, there's no need for a cap. Generally Hall effects have an open-collector output so you can pull it up to Vdd, then simply feed into an input pin.

    You are best off using the COUNT command in this case, though PULSIN would work too.

    -Martin

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Martin Hebel
    StampPlot - Graphical Data Acquisition and Control
    AppBee -·2.4GHz Wireless Adapters & transceivers·for the BASIC Stamp & Other controllers·
  • TGTG Posts: 36
    edited 2006-12-02 23:25
    I want to calculate the accel rate. I am thinking the resolution will be better using the PulsIn method rather than the Count. I only have four counts per rev. Why do you prefer the COUNT method?
  • Martin HebelMartin Hebel Posts: 1,239
    edited 2006-12-02 23:52
    If you are measuring RPM, using COUNT is more direct. But for your need PULSIN would work fine too. Just an opinion on my part.

    -Martin

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Martin Hebel
    StampPlot - Graphical Data Acquisition and Control
    AppBee -·2.4GHz Wireless Adapters & transceivers·for the BASIC Stamp & Other controllers·
  • TGTG Posts: 36
    edited 2006-12-03 00:01
    ok, thank you for your input
Sign In or Register to comment.