Forum > Packages and Libraries

Synaser Receive problem: single chars OK, strings are buffered

(1/1)

Marcovaldo:
Hello All,

I have a strange problem with synaser:

(versions:
Synaser 16, fpc under ARM linux (EABI), under Debian Etch 2.4 Kernel and also under embedded
Kernel 2.6xx)

pseudocode
----------------
ser := TBlockserial.Create;
ser.RaiseExcept := true;
ser.LinuxLock := false;
ser.Connect( '/dev/ttyS1');
ser.Config( 9600, 8, 'N', 0, false, false);
repeat
    while (ser.WaitingData > 0) do         
       begin                                             
       rxb:= ser.RecvByte(waittime); 
       dump(rxb);
       end;
Sleep(10);
until false;

if I send serial characters from a 2nd device:
--------------------------------------------------------
- if single chars are sent (like keys pressed on a terminal) - all is OK
- if strings are sent the following strange happens:
  transmitted                  received
  abc                               a                       (only first character)
  defg                              abcd                 (rest of first string and first char of 2nd string)
  hij                                  abcdefgh         (rest of 2nd string and first of 3rd string...)


Any ideas what I might do wrong?

Kind Regards,

     Marcovaldo
 

Marcovaldo:
found a solution (but not too much idea why the other version didn't work too...)

if wks := ser.RecvPacket(timeout) is used instead, it works properly


Marcovaldo

eldonfsr:
if you increase the waitime could be work for example waittime :=10000

Navigation

[0] Message Index

Go to full version