Shop OBEX P1 Docs P2 Docs Learn Events
DS1620 and below zero temperatures — Parallax Forums

DS1620 and below zero temperatures

MoskogMoskog Posts: 554
edited 2012-11-27 03:13 in Propeller 1
OK, so I have this simple program:

[code]CON _clkmode = xtal1 + pll16x
_xinfreq = 5_000_000


OBJ
debug : "VGA_Text"

VAR
long tc

PUB Main
Highbyte := %00000001
Lowbyte := %11001110 ' (-25

Comments

  • SRLMSRLM Posts: 5,045
    edited 2012-11-26 13:02
    I suppose you're looking for something more elegant than an IF statement?
    if tc < 0
       debug.tx("-")
       tc := || tc
    
    Debug.dec(tc / 10)
    Debug.str (string("."))
    Debug.dec (tc // 10)
    Debug.str (string(" °C"))
    
  • MoskogMoskog Posts: 554
    edited 2012-11-26 22:14
    I suppose you're looking for something more elegant than an IF statement?

    Well I really thought there was a more elegant way but that doesn't really matter. Strange that the Propeller DS1630-demos found seems to only handle the positive temperatures.
  • ErlendErlend Posts: 612
    edited 2012-11-26 23:36
    Why do you need to read positive temperatures? - in Norway the temperature surely is always well below zero :cool:
  • MoskogMoskog Posts: 554
    edited 2012-11-27 03:13
    Why do you need to read positive temperatures? - in Norway the temperature surely is always well below zero

    You are absolutely right, but thats why I need the minus sign to be there -and to be in the right place.
Sign In or Register to comment.