Click to See Complete Forum and Search --> : Help: Serial communication - multithreading


Einly
January 2nd, 2005, 10:51 PM
Dear all,

I wish to continuously read the serial port and keep it in a temporary place. After 1kByte of data is collected in the temporary place, the main program will be notified and will process the data. At the same time the reading thread keeps on running and fill in the temporary place. May I know does anyone have any idea how this can be done? How many threads should I create? What is the best method to do this? How to continuously read the serialport and transfer data? Using timer? How to stop the reading process?

Thanks a lot

Ofer Erlich
January 3rd, 2005, 12:15 AM
Hi,

There is an article about serial communication its name is "Serial Communications in Win32" by Allen Denver. It's a great article and will give you where to start from.
Beside that you should open one thread that will read (function ReadFIle) in a loop (you can tell the function to read 1K) and than pass the data to the main thread for handling. Read the article and if you have problem after that ask again

Andreas Masur
January 3rd, 2005, 03:50 AM
Serial Communications in Win32 (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnfiles/html/msdn_serial.asp)