Hi Jerson and Jerry,
I appreciate the help from both of you. I was able to take the parts I liked best from both of your functions and merge them into this....
MyData var byte[5] 'Data array
LongData var long 'Base ten multiplier
Index var byte 'Array index
LongData = 0 'Initialize the variable
For Index = 0 to 4 step 1 ' potential non-digits in MB locations
If MyData[Index] > 47 AND MyData[index] < 58 Then ' allow only ascii digits 0 to 9
LongData = LongData * 10 ' carry it over
LongData = LongData + MyData[Index] - 48 ' subtract away ASCII offset
ENDIF
NEXT Index
HSEROUT [DEC LongData]
I've tested it by feeding it some array data like this:
MyData[0] = "7"
MyData[1] = "1"
MyData[2] = "0"
MyData[3] = "9"
MyData[4] = " "
and the serial port data (the Long) reflects the ASCII data, so it seems like we have success!
Thanks again!
TR
Bookmarks