i have a problem converting the byte i get from the tag into serial number.
i get this byte from the tag: 2 52 66 48 48 65 57 55 70 57 48 48 68 13 10 3
i'm code it in C#, and here is the code :
SerialPort port = new SerialPort("COM2", 9600, Parity.None, 8, StopBits.One);
port.Open();
while (true)
{
if (port.BytesToRead > 0)
{
byte b = (byte)port.ReadByte();
Console.WriteLine(b);
}
}
port.Close();
the tag serial number is : 0011108240.
i have tried to convert those number to ASCII, but i didn't get anything. so how to get the 0011108240 from the byte i received from the tag?
here is the code i got from the manual, it's written in pascal and i dont get it, anyone can tell me how?
function tform1.hextoint(input : string):longint;
var
c,i : longint;
input1 : string;
begin
c:=0;
input1:='';
for i:=length(input) downto 1 do input1:=input1+input[i]+'';
input1:=uppercase(input1);
for i:=1 to length(input1) do
begin
if (input1[i] in ['A'..'F'])and(i>1)then
c:=((ord(input1[i])-ord('A')+10) shl (4*(i-1)))or c
else
if (input1[i] in ['0'..'9'])and(i>1)then
c:=((ord(input1[i])-ord('0')) shl (4*(i-1))) or c
else
if (input1[i] in ['A'..'F'])and(i=1)then
c:=(ord(input1[i])-ord('A')+10) or c
else
if (input1[i] in ['0'..'9'])and(i=1)then
c:=(ord(input1[i])-ord('0')) or c;
end;
result:=c;
end;
thanks.