Author Topic: small negative temperatures on lcd  (Read 10460 times)

william

  • Newbie
  • Posts: 11
    • View Profile
small negative temperatures on lcd
« on: October 11, 2004, 04:16:24 AM »
I would like to display both positive and negative temperatures  to one decimal place using setlcd. My code is:
A$ = STR$(A/10) +"."+STR$(ABS(A) MOD 10,1)
This works fine except for temperatures between -0.1 and -0.9  when the display is positive not negative. Any simple ideas?
     

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:small negative temperatures on lcd
« Reply #1 on: October 13, 2004, 07:39:52 AM »
perhaps the simplest will be to test the value of A and then add the negative sign if it is negative:

A$ = STR$(A/10) +"."+STR$(ABS(A) MOD 10,1)
IF A < 0  THEN
   A$ = "-"+A$
ENDIF
Email: support@triplc.com
Tel: 1-877-TRI-PLCS