That code is expecting "<Hello world!>", not "Hello world!".
If you are indeed sending "<Hello world!>", and getting a response back that is "chopped up", then it is your receiver that is doing the "chopping up".
as you can see somewhere in the middle of the form I have an editbox where I insert my string, and it says "<Hello world!>".
also as I said before, I use the same COM program to communicate with a mobile phone using AT commands, and there is no problem with chopped up strings what so ever.
this is the delphi code, theres nothing else involved in data recieve from com port other than this:
var
I : Word;
C : AnsiChar;
s: string;
begin
if count=0 then exit;
s:='';
for I := 1 to Count do begin
C := ApdComPort1.GetChar;
s:=s+C;
end;
Where does count come from? If it's the number of characters in the Serial buffer, then that could explain why you are getting more lines.add()s than you expect.
sorry, this is the full procedure:
procedure TForm1.ApdComPort1TriggerAvail(CP: TObject; Count: Word);
var
I : Word;
C : AnsiChar;
s: string;
begin
if count=0 then exit;
s:='';
for I := 1 to Count do begin
C := ApdComPort1.GetChar;
s:=s+C;
end;
memo1.Lines.Add(s);
end;
it doesnt make sense, because if I ask arduino to programmatically send me a fixed string, it does the same, it doesnt matter what the arduino sends me, i get the strings in pieces to the PC.
You know?
Ill have to try another COM program to see if mine is defect. Ill come back in a bit
That does make some sense. You are doing serial comms at 9600 baud. That, to your PC, is really, really, very slow. It's quite possible that your ApdComPort1TriggerAvail() event is being triggered with only part of the full text in the the serial buffer. The procedure will only read count characters from the buffer, and will then do a Lines.Add() with that partial string.
What is sending serial data to the Arduino to display? The second statement here implies that the data is not coming from the serial monitor. If it was, the program has nothing to display until the Serial Monitor sends it something, so it would be hard to imagine that the Arduino could be displaying weird behavior.
If the data is coming from some other source, and opening the serial monitor corrects the way that the serial port is configured, as well as resetting the Arduino, then that implies two things.
First, it implies that you are not using a Windows OS. Second, it implies that whatever else is sending serial data to the Arduino is not configuring the serial port correctly.
I am using and app called "arduino-serial" to send text to the Arduino to then forward on to LCD.