Well... I suspected that. Anyway, I had made two things: first tried 56000 bps, and it boost communications 50% up. Second, I set the thread priority to Time critical, but it makes no effect at all. My program must comunicate with 1 to 120 hardwares (amplifiers), and each one must be accessed 5 times for second... The problem is that there are 2 to 3 bytes to send and 1 to 3 bytes to receive each time. Seems that I´ll have a big trouble here. Did you know if I use overlapped mode I can fix the problem? Will windows call immediately my thread when data is ready? For curiosity purposes, can you say how many time is shared for each thread in this multi-tasking proccess? Thanks Flavio
----- Original Message ----- From: "David J Taylor" <[EMAIL PROTECTED]> To: "Borland's Delphi Discussion List" <[email protected]> Sent: Thursday, September 08, 2005 11:28 AM Subject: Re: COM speed problem Moacir Flávio Gonçalves wrote: [] > The question is: What is that 1ms between receive and next send? The bland answer is that Windows is not a real-time OS. Consider what happens: - character is received - operating system changes from user mode to kernel mode - operating system detects the interrupt from the port controller - operating system handles the interrupt - determines it is for your process - boosts the priority of your process - determines which is the next scheduled process to run (might not be yours) - wakes up your process - schedules it for running - your process completes any I/O in kernel mode - may require the data to be moved from system space to user space - your process does its stuff - your process queues an I/O request for the system - system moves data from your space to system space - system starts the I/O for you The same process applies (broadly) whether you receive one character or 16 (think of the buffering in the UART). I'm sure there are tweaks you can make to improve the throughput, but a single character at a time is about the worst possible case. I also recall some peculiarities about response times at different baud rates. You may want to check try different baud rates and see what happens. Sorry but I don't have any references for this effect right now. Cheers, David _______________________________________________ Delphi mailing list -> [email protected] http://www.elists.org/mailman/listinfo/delphi _______________________________________________ Delphi mailing list -> [email protected] http://www.elists.org/mailman/listinfo/delphi

