I'm using a CR6 to communicate to a device via TTL and parse the incoming string. The string is parsed into hex values, and this is where my problem starts; The only function I could find built into the CRBasic was HexToDec, which converted the string to an unsigned 32-bit Long. Is there an easy way for me to convert the Hex to signed 16-bit Short?
Get it into a 32 bit Long, then handle the sign.
Here is a simple Function you can use to handle the sign on a 16 bit integer:
Function SignedInt16(tempDec As Long) 'Converts two byte long to 16bit signed If tempDec>32767 Then tempDec=tempDec-65536 EndIf SignedInt16=tempDec EndFunction