Hi Dj
You do not need to force the values to Hex, instead you need to convert the HEX values to word. Since PBP does not support a function like VB does, you need to build this code. A simple routine to convert a hex character to byte would be
Now, you would do this 4 times once for each nibble in the word you are converting and get your Hex word like thisCode:' expects a HEX character with capitalized A-F values Hex2Bin: Hexchar = Hexchar - "0" ' remove the value of ascii 0 (30H) if Hexchar > 9 then Hexchar = Hexchar - 7 ' convert A-F to 0a-0Fh return
Now, WordVal would contain the 16 bit representation of the 4 character Hex StringCode:WordVal = 0 ' start with a val of 0 read a hex character to HexChar gosub Hex2Bin WordVal = WordVal * 16 + HexChar read a hex character to HexChar gosub Hex2Bin WordVal = WordVal * 16 + HexChar read a hex character to HexChar gosub Hex2Bin WordVal = WordVal * 16 + HexChar read a hex character to HexChar gosub Hex2Bin WordVal = WordVal * 16 + HexChar




Bookmarks