
Originally Posted by
Byte_Butcher
Well, I got lost in a world of fire wood this week and haven't had a chance to look through all these great suggestions. But THANKS to everyone for the input so far. Hopefully in the next day or 2 I'll get a chance to try again.
Norm, you're killing me with those "Longs".... that's going to be tough to implement with my 16F887!

No longs, 2 decimals. no round.
Enter C value 124.56 as 12456
Norm
Code:
C VAR WORD
F VAR WORD
iSIGN VAR BIT
GOTO MAIN
subC_TO_F:
DISABLE ' Necessary if On Interrupt used
F = C * 9
F = DIV32 5
ENABLE ' Necessary if On Interrupt used
IF iSIGN = 1 THEN 'if the sign bit is "1" is minus C
IF F > 3200 THEN
F = F - 3200
SEROUT2 sSEROUT_PIN,cBAUD,[" -",DEC C/100,".",DEC2 C," C = -",DEC F/100,".",DEC2 F," F",13]
ELSE
F = 3200 - F
SEROUT2 sSEROUT_PIN,cBAUD,[" -",DEC C/100,".",DEC2 C," C = ",DEC F/100,".",DEC2 F," F",13]
ENDIF
ELSE
F = F + 3200
SEROUT2 sSEROUT_PIN,cBAUD,[" ",DEC C/100,".",DEC2 C," C = ",DEC F/100,".",DEC2 F," F",13]
ENDIF
RETURN
MAIN:
SEROUT2 sSEROUT_PIN,cBAUD,[" ",13]
SEROUT2 sSEROUT_PIN,cBAUD,["START",13]
iSIGN = 1
FOR C = 100 TO 0 STEP -1 '-1.00 C TO 0 C
GOSUB subC_TO_F
NEXT
iSIGN = 0
FOR C = 0 TO 100 STEP 1 '0 C TO 1.00 C
GOSUB subC_TO_F
NEXT
iSIGN = 1
FOR C = 5500 TO 0 STEP -100 '-55.00 C TO 0 C 'DO STEP -1 FOR COMPLETE BUT FOREVER
GOSUB subC_TO_F
NEXT
'12500 IS 125.00 * 100 TO HOLD 2 DECIMAL PLACES
iSIGN = 0
FOR C = 0 TO 12500 STEP 100 '0 C TO 125.00 C 'DO STEP 1 FOR COMPLETE BUT FOREVER
GOSUB subC_TO_F
NEXT
STOP
END
Bookmarks