Shop OBEX P1 Docs P2 Docs Learn Events
Correctly showing a value on a display — Parallax Forums

Correctly showing a value on a display

TCTC Posts: 1,019
edited 2013-06-03 18:01 in Propeller 1
Hello all, I need a little help correctly showing a value on my LCD display. My variables are integer, but I need to show a decimal point. The decimal point never really moves, For example;
MyVar := 100000
On display = 100.000

MyVar := 10000
On display = 10.000

MyVar := 1000
On display 1.000

MyVar := 123456
On display = 123.456

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2013-06-03 14:43
    Post your code. From the examples you've posted, you're getting a perfectly good display of 3 decimal places for a variety of values. What are you trying to do?
  • TCTC Posts: 1,019
    edited 2013-06-03 15:43
    Mike Green wrote: »
    Post your code. From the examples you've posted, you're getting a perfectly good display of 3 decimal places for a variety of values. What are you trying to do?

    It is for a 3d printer. the code I am working with takes the string value (N3 G1 X1.104 Y2.500 Z-.100) from the host software, converts it to intergers (N=3, G=1, X=1104, Y=2500, Z=-100). all the coordinance are 3 decimal places, and my display object works just like "Parallax Serial Terminal"

    I used those examples from my first post just to give an idea of what I was talking about, they are not in my code.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2013-06-03 15:58
    I've posted a method called "DecPoint" a few times to the forum. It should do what you want. If you have trouble finding it, let me know.
  • TCTC Posts: 1,019
    edited 2013-06-03 18:01
    Duane Degn wrote: »
    I've posted a method called "DecPoint" a few times to the forum. It should do what you want. If you have trouble finding it, let me know.

    That worked great, Thank you very much.
Sign In or Register to comment.