Shop OBEX P1 Docs P2 Docs Learn Events
Displaying decimal values — Parallax Forums

Displaying decimal values

Anthony240Anthony240 Posts: 24
edited 2006-03-03 19:02 in BASIC Stamp
I have been working with the basic stamp trying to measure salinity.· I have finally got the circuit to measure changes in resistance when I place my probes in different salt water solutions.· I now have ran into another problem.· I cannot display the numbers in decimal values.· Anything below 1 shows up as 0.· I am needing to display salinity as specific gravity and those numbers are around 1.023-1.028

thanks

Comments

  • marzec309marzec309 Posts: 146
    edited 2006-03-03 15:20
    What is happening is the basic stamp works with whole numbers. So when you get a reading of 1.023 the stamp will round that to 1. you should be able to chang your circuit so your readings are whole numbers. Like a reading of 1023. then change that to a decimal
    manualy with the debug camand.

    here is a peace of code to give you an idea:

    number CON 1023

    DO
    DEBUG HOME, CR, DEC1 number/1000, ".", DEC3 number - 1000

    LOOP

    try it. it works
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2006-03-03 19:02
    You don't even need the "- 1000" at the end; using DEC3 truncates to the lowest three digits.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
Sign In or Register to comment.