• Welcome to Forum.Deepsoftware.Com. Please login or sign up.
 
April 24, 2024, 02:23:04 pm

News:

SMF - Just Installed!


ezcaner

Started by ezcaner, March 21, 2022, 04:24:48 pm

Previous topic - Next topic

ezcaner


Hello greetings I have nrComm Lib 9.45 installed in Delphi Berlin in Windos 10-64
 I have this detail to be able to finish a project.
It needed to send this variable string that calculates at the moment the data is received and there it is sent
nrComm1.SendString(Ansistr);
where:
var
str: string;
ansistr:ansistring;

str:=Concat(prim,i7,i11,i15,i17,i19,ch1);
AnsiStr:=AnsiString(Str);
nrComm1.SendString(Ansistr);

answer me
nrComm1AfterReceive
with a short string which is not correct.

czech with a generated string
nrComm1.SendString(#$4D#$05#$FB#$36#$BA#$B0#$27#$EC);
answer me
nrComm1AfterReceive
with a long string that if correct.

the values ​​that supposedly in the variables are
str:=Concat(prim,i7,i11,i15,i17,i19,ch1);
prim:='#$4D#$05';
i7:='#$FB';
i11:='#$36';
i15:='#$BA';
i17:='#$B0';
i19:='#$27';
ch1:='#$EC';
Where
(prim,i7,i11,i15,i17,i19,ch1)=#$4D#$05#$FB#$36#$BA#$B0#$27#$EC
I don't understand why he answers me in each different case
only that what you develop is not correct.

I already checked in the forums and I didn't find anything related
http://forums.nrcommlib.com/index.php?board=19.0

Roman Novgorodov

March 22, 2022, 01:54:47 am #1 Last Edit: March 22, 2022, 03:46:20 am by Roman Novgorodov
Hello

I do not understand your question.

Usual the workflow is following:
App sends chars to device and gets reply.
App need to analyze incoming bytes in AfterReceive event and detects reply.
App detects reply and send next command to device if it's necessary.

Please note that long reply can by separated to several calls of AfteReceive event and your code must to accumulate incoming chars correctly. More read here: http://forums.nrcommlib.com/index.php?topic=8.0

You can detect reply by fixed length or by fixed END char sequence.
Small demo you can find here:
Demos\SimplePacket\SimplePacket.dpr


Roman Novgorodov
DeepSoftware llc
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.