hex num changed..
Dear All,
i found that if i send out a hex num that bigger than 7F, which is 80 to FF in hex format, it actually sending out a 3F instead of "80" or "8F". i short my serial port pin2 n pin3 so that i can read what i've sent out. below is my codes for ur review:
Dim num1 As String = strwhole.Substring(0, 2)
Dim tmp1 As Integer=Integer.Parse(num1,System.Globalization.Nu mberStyles.HexNumber)
Dim c1 As Char = Convert.ToChar(tmp1)
port.WriteLine(c1)
Dim ch1 As Char = port.ReadLine()
tmp1 = Convert.ToInt16(ch1)
Dim str1 As String = Convert.ToString(tmp1)
Response.Write(str1)
if i try send 7F in hex, it did send 7F. Any idea? where did i wrong? pls advice.
Best Regards
life's Ng
|