[EMAIL PROTECTED] wrote:
> OK,
> No response yet, But i have simplified my code as 'terminated' cause a
> problem. So while the new code will run I get an error after the
>
Instead of a "Repeat ... Until false" loop try a "While not(Terminated)
do" loop
> Recvstring timeout.
> 'ESynaSerError with message 'Communication error 9997' Timeout during
> operation'.
>
Probably because of the "ser.RaiseExcept := True" statement. Try it
without this.
> What does this mean?
> How can I improve my simple code?
>
> code as follows
>
> code---------------
>
> program dataser;
>
> {$APPTYPE CONSOLE}
>
> uses
> synaser,
> sysutils;
>
> var
> ser:TBlockSerial;
> LCMD:String;
> begin
> ser:=TBlockserial.Create;
> try
> ser.RaiseExcept:=True;
> ser.Connect('COM1');
> ser.Config(9600,8,'N',0,false,false);
> if ser.lastError<>0 then exit;
> LCMD := ser.Recvstring(10000);
> writeLn('LCMD');
> finally
> ser.Free;
> end;
> end.
>
> end od code-------------------------------------
>
>
> Lloydie T
>
>
>> Hi,
>> I wish to use synaser to capture text sent to a serial port. I do not
>> have a test facilty at the moment, so I need a little help to make sure
>> I am going in the right direction.
>>
>> The basic code I have is as follows.
>> code----------------------------------
>>
>> {$MODE DELPHI}
>>
>> Program testser;
>>
>> uses
>> synaser, sysutils;
>>
>> var
>> ser:TBlockSerial;
>> LCMD:String;
>> begin
>> ser:=TBlockserial.Create;
>> try
>> ser.RaiseExcept:=True;
>> ser.Connect('COM1');
>> ser.Config(9600,8,'N',0,false,false);
>> with ser do
>> begin
>> repeat
>> if terminated then break;
>> LCMD := RecvString(1000);
>> if lastError<>0 then break;
>> writeLn('LCMD');
>> if lastError<>0 then break;
>> until false;
>> end;
>> finally
>> ser.Free;
>> end;
>> end.
>>
>> End of code----------------------------------
>>
>> Does this look OK?
>> If not, how should I do this?
>>
>> Lloydie T
>>
>>
>>
>> -------------------------------------------------------------------------
>> This SF.net email is sponsored by: Microsoft
>> Defy all challenges. Microsoft(R) Visual Studio 2005.
>> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>> _______________________________________________
>> synalist-public mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/synalist-public
>>
>>
>
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2005.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> synalist-public mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/synalist-public
>
>
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
synalist-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/synalist-public