Shop OBEX P1 Docs P2 Docs Learn Events
BS2 Ping! with decimal point — Parallax Forums

BS2 Ping! with decimal point

Anvil GrinderAnvil Grinder Posts: 3
edited 2008-05-14 22:06 in BASIC Stamp
How can I debug with a decimal point (example 0124.25) using Ping! Ultrasonic Sensor and a BS2 Homework Board. I have already assembled it and it works great. My only problem is that I need a higher resolution than what is shown with example code. It shows whole numbers and what I need is one hundredth place to the right of a decimal point (example 0124.25). I am new at this and am stumped right now.
Thank you for any help.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-05-14 22:06
    All arithmetic on the Stamp is 16 bit integer. It's quite easy to do scaled fixed point arithmetic where you represent something like 124.25 as the integer 12425 and scale any arithmetic appropriately. There's some discussion on this website on scaled fixed point arithmetic (and lots of other useful stuff): www.emesystems.com.
Sign In or Register to comment.