Author Topic: How to Display Decimal Point on LCD  (Read 20923 times)

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
How to Display Decimal Point on LCD
« on: December 21, 2006, 03:57:51 PM »
Although TBASIC doesn't support floating point, you can still display numeric with decimal point on the LCD easily. This will be useful if you are using fixed point arithmetic where an integer unit represent a fraction of the real number.  For example, if every unit represent 0.01 degree, then a quantity 228.66 will be represented as 22866.

To display DM[1] with two decimal places, do the following:

SETLCD 1,1, STR$(DM[1]/100)+"."+ STR$(DM[1] mod 100,2)


« Last Edit: August 10, 2007, 10:56:24 AM by support »
Email: support@triplc.com
Tel: 1-877-TRI-PLCS