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
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
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
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.
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?
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST
mph var word
main:
pulsin 8, 1, mph ' Get reading
debug 2,1,1, "mph ", dec3 mph ' Display mph
goto main ' around forever
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.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST
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·
-Martin
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Martin Hebel
StampPlot - Graphical Data Acquisition and Control
AppBee -·2.4GHz Wireless Adapters & transceivers·for the BASIC Stamp & Other controllers·