Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Windows XP and Delphi XE5



Permlink Replies: 3 - Last Post: Mar 25, 2015 10:53 AM Last Post By: Remy Lebeau (Te... Threads: [ Previous | Next ]
Marko Ravnik

Posts: 23
Registered: 12/8/13
Windows XP and Delphi XE5
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 24, 2015 1:43 AM
Hello!

I have written a HMI in delphi XE5 on windows 7 laptop, execution is fast and works great. But once i deploy it on machine with windows XP the preformace of ComPorts communication is very slow. For exsample maschine test time on laptop with windows 7 took 5 seconds while on XP maschine it took 13 seconds. There is a strange delay in Serial communication. What could couse this?
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: Windows XP and Delphi XE5
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 24, 2015 9:28 AM   in response to: Marko Ravnik in response to: Marko Ravnik
Marko wrote:

I have written a HMI in delphi XE5 on windows 7 laptop, execution
is fast and works great. But once i deploy it on machine with windows
XP the preformace of ComPorts communication is very slow. For
exsample maschine test time on laptop with windows 7 took 5 seconds
while on XP maschine it took 13 seconds. There is a strange delay in
Serial communication. What could couse this?

There is no way to answer that without knowing how you are accessing the
serial port to begin with. Are you using a component/library, or the Win32
API directly? Are you using synchronous I/O, asynchronous I/O, or overlapped
I/O? Are you using threads or message queues? These kinds of detail are
important when performance is a factor.

--
Remy Lebeau (TeamB)
Marko Ravnik

Posts: 23
Registered: 12/8/13
Re: Windows XP and Delphi XE5
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 25, 2015 6:09 AM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
I have written my own commponents to access those instruments, components use TComport libraries by Dejan Crnila. I have one single thread (JEDI JvThread) from wich i set instruments and run tests. Only one instrument is set at time so there is no overlap.
Below is exsample of how i send commands to instruments:
I now that sleep() is bad practice but it works great on many computers only this one is giving me the truble.
 
function TTOS9200.send_str_TOS9200(send_command : string; terminator : string) : boolean;
var counter  : integer;
    nr_tries : smallint;
begin
 
     return_string_TOS9200:=''; nr_tries:=0; result:=false;
     repeat
           Comport.WriteStr(send_command + chr(13) + chr(10));
           counter :=0;
              while (Pos('OK' + terminator, return_string_TOS9200) = 0)  AND (counter < 100) do
                    begin
                         sleep(5);
                         Inc(counter);
                    end;
                    if (counter < 100) AND  (Pos(terminator, return_string_TOS9200) > 0) then
                       result:=true;
              inc(nr_tries);
     until  (nr_tries > 10) OR (Pos(terminator, return_string_TOS9200) > 0);
     if nr_tries > 10 then
        begin
             result:= false;
        end;
end; 


Remy Lebeau (TeamB) wrote:
Marko wrote:

I have written a HMI in delphi XE5 on windows 7 laptop, execution
is fast and works great. But once i deploy it on machine with windows
XP the preformace of ComPorts communication is very slow. For
exsample maschine test time on laptop with windows 7 took 5 seconds
while on XP maschine it took 13 seconds. There is a strange delay in
Serial communication. What could couse this?

There is no way to answer that without knowing how you are accessing the
serial port to begin with. Are you using a component/library, or the Win32
API directly? Are you using synchronous I/O, asynchronous I/O, or overlapped
I/O? Are you using threads or message queues? These kinds of detail are
important when performance is a factor.

--
Remy Lebeau (TeamB)
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: Windows XP and Delphi XE5
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 25, 2015 10:53 AM   in response to: Marko Ravnik in response to: Marko Ravnik
Marko wrote:

I have written my own commponents to access those instruments,
components use TComport libraries by Dejan Crnila. I have one single
thread (JEDI JvThread) from wich i set instruments and run tests.
Only one instrument is set at time so there is no overlap.
Below is exsample of how i send commands to instruments:
I now that sleep() is bad practice but it works great on many
computers only this one is giving me the truble.

You did not show the code that is reading the response from the serial port.
But eithe way, I would not use a busy loop to handle this. I would use
a TEvent instead. Have the reading code look for 'OK' as it is reading,
and signal the TEvent when 'OK' is found, and then send_str_TOS9200() can
simply wait on the TEvent to be signaled.

--
Remy Lebeau (TeamB)
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02