What version of Delphi are you using? Could the string be returned as a Unicode string? or is it an AnsiString?<div><br></div><div>Secondly, shouldn't the for loop be: for i := 0 to Length(sRaw) do </div><div><br></div>
<div>Regards,</div><div>Colin</div><div><div><br><div class="gmail_quote">On 5 August 2011 10:34, Marshland Engineering <span dir="ltr"><<a href="mailto:marshland@marshland.co.nz">marshland@marshland.co.nz</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">I still have something wrong<br>
<br>
I sending<br>
serial_send('B');<br>
serial_send('C');<br>
and a terminal program reads BC correctly<br>
<br>
My Delphi code is as below but something is wrong with the second character.<br>
<br>
if SerialPortNG.NextClusterSize >= 0 then begin<br>
sRaw:=SerialPortNG.ReadNextClusterAsString;<br>
memo1.Lines.Add(sRaw);<br>
sData:='';<br>
for i:=1 to length(sRaw) do begin<br>
iValue:= ORD(sRaw[i]);<br>
sData:=sData+IntToStr(iValue)+' ';<br>
end;<br>
memo1.Lines.Add(sData);<br>
<br>
Result<br>
Bč<br>
66 232<br>
Bč<br>
66 232<br>
Bč<br>
66 232<br>
<br>
_______________________________________________<br>
NZ Borland Developers Group - Delphi mailing list<br>
Post: <a href="mailto:delphi@delphi.org.nz">delphi@delphi.org.nz</a><br>
Admin: <a href="http://delphi.org.nz/mailman/listinfo/delphi" target="_blank">http://delphi.org.nz/mailman/listinfo/delphi</a><br>
Unsubscribe: send an email to <a href="mailto:delphi-request@delphi.org.nz">delphi-request@delphi.org.nz</a> with Subject: unsubscribe<br>
</blockquote></div><br></div></div>