
6
Chapter 3
232DTT1795 Manual
B&B Electronics -- PO Box 1040 -- Ottawa, IL 61350
PH (815) 433-5100 -- FAX (815) 434-7094
6. To convert to Celsius, divide by two.
7. To convert to Fahrenheit, multiply the Celsius value by 9; divide
the result by 5; then add 32.
In the BASIC language, these steps look like this:
‘DTT data has been stored in CHAR1$ and CHAR2$
negative = ASC(CHAR1$)
‘ASCII val of sign char (1 or 0)
reading = ASC(CHAR2$)
‘ASCII val of reading
IF negative = 1 THEN
reading = NOT reading ‘invert all bits (complement)
reading = reading AND &HFF
‘limit variable to 8 bits
reading = r 1
‘finish complement procedure
reading = reading * -1
‘multiply by -1 to add minus sign
END IF
Ctemp = reading / 2
‘Celsius temperature
Ftemp = (9 * C temp / 5) + 32
‘Fahrenheit temperature