If you make an assumption firstly that you have valid (UPPERCASE) ASCII HEX and not Klingon or some other alien data... then your ASCII HEX to Numeric conversion could be as simple as...
Code:
DataA=AsciiHexByte-48
If DataA>9 then DataA=DataA-7
If you need to handle UPPERCASE or lowercase (valid) HEX, then your code needs an extra line...
Code:
DataA=HEXByteInput-48
If DataA>9 then DataA=DataA-7
If DataA>15 then DataA=DataA-32
What YOU are doing is NOT converting ASCII HEX... you are converting one form of Number representation to another form of exactly the same number... $A=10 anyway, so what you are doing is stating...
If DataA=$A then DataA=10
... which is the same as...
If DataA=10 then DataA=10
... which is kinda pointless... what you should have said is...
If DataA="A" then DataA=10
... or to be long-winded about it...
If DataA=65 then DataA=10
... because $A=10 whilst "A"=65
Bookmarks