PDA

View Full Version : pulsin command



Tobias
11-29-2006, 12:45 PM
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

Zoot
11-30-2006, 11:31 PM
Can you post some code and/or a circuit?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST

Tobias
12-01-2006, 10:15 AM
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

Zoot
12-01-2006, 10:37 AM
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

TG
12-03-2006, 02:31 AM
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 Hebel
12-03-2006, 04:17 AM
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 (http://www.stampplot.com/)
AppBee -·2.4GHz Wireless Adapters & transceivers·for the BASIC Stamp & Other controllers (http://www.selmaware.com/appbee)·

TG
12-03-2006, 06:25 AM
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 Hebel
12-03-2006, 06:52 AM
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 (http://www.stampplot.com/)
AppBee -·2.4GHz Wireless Adapters & transceivers·for the BASIC Stamp & Other controllers (http://www.selmaware.com/appbee)·

TG
12-03-2006, 07:01 AM
ok, thank you for your input