Can't post my whole class because its a work project and it depends on a few other classes that you wouldn't have but hopefully this can get you started.
//Make sure synaser is in your uses clause
//Create object
mySerialPort := 'COM1';
myBaudRate := 19200;
myBits := 8;
myParity := 'N';
myStop := 0;
mySoftFlow := False;
myHardFlow := False;
mySerial := TBlockSerial.Create();
try
mySerial.RaiseExcept := False;
mySerial.LinuxLock := False;
mySerial.Connect(mySerialPort);
mySerial.Config(myBaudRate, myBits, myParity, myStop, mySoftFlow, myHardFlow);
s := mySerial.LastErrorDesc;
except
FreeAndNil(mySerial);
end;
//Sending stuff
mySerial.SendString(s);
//Receiving stuff
while (mySerial.CanRead(100)) do
begin
s := mySerial.RecvPacket(0);
ReceivedData := ReceivedData + s;
end;
if (Length(ReceivedData) > 0) then
begin
//Do what you want to with the received data.
//I post it onto a global MessageQueue for my app.
ReceivedData := '';
end;
This all sits in its own thread with the sending and receiving taking place in the execute method. In my class any received data is put into a global message queue so that the main thread can process the messages received.
Hopefully this provides a starting point for you.