Forum > Beginners

Serial seems to be slow

(1/4) > >>

kensmith:

I suspect that the serial unit spins up a thread to watch the serial port.  For what I am doing with the serial port, this is not a great thing.
Basically I want to:
1) put one character into the output buffer of the UART
2) detect if an received character is waiting in the input buffer.
3) Get that character.
All of my code works one byte at a time and has to do logic on every received byte.
Right now something that should take about 10 Minutes at 115200 baud takes about 1.5 hours.  The code never even gets close to shoulder characters as it works.
Nobody is going to mind if my program makes the computer unresponsive for several seconds at a time.  I am already running the Application.ProcessMessages at a few points in the code to let user actions slip by while I have a gap in what I need to do.
Would TLaxSerial be better or is there some other option to get the speed up?

Jurassic Pork:
Hello,
can you show  us  the code ?
Friendly, J.P

MarkMLl:

--- Quote from: kensmith on June 07, 2022, 08:09:19 pm ---I suspect that the serial unit spins up a thread to watch the serial port.

--- End quote ---

/WHICH/ serial unit? serial.pp most definitely does not.

What's your target OS? What version of compiler etc.? Have you got an example that demonstrates the problem?

MarkMLl

ccrause:

--- Quote from: kensmith on June 07, 2022, 08:09:19 pm ---Would TLaxSerial be better or is there some other option to get the speed up?

--- End quote ---
Before concluding that you have a software issue, more information is required (as mentioned by J.P. and Mark).  Also, the hardware interface may be important.  It is likely that you are using some kind of USB-serial converter, in which case the data transfer is subject to USB polling delay.  Then the OS driver may use buffering with a small delay to try and pack as much data into a USB packet as possible.  This may be bad for the latency of short data bursts.

winni:
Hi!

What you are trying to do is called the Kermit Protocoll.
It was widely used in the late 70s and early 80s on then unstable serial lines.

There were a lot of implementations in C, Turbo Pascal, Basic ,  ...
You should find the Turbo sources in the Net.

If you set the fpc in the Turbo Mode then the Port Array is supported (Only Linux and DOS).

With a port assignement you can directly fetch or send bytes from the UART.
That's how we used the serial lines at that time with CP/M or DOS.

I don't know if that works with todays Hardware and OS but you could give it a try.

Winni

PS.: The Kermit sources for nearly everything including Turbo Pascal:

http://www.columbia.edu/kermit/archive.html

Navigation

[0] Message Index

[#] Next page

Go to full version