Weired serial port problem
Hi guys:
Here are the sample codes about read and write of the serial port.
serial.zip only uses nonoverlapped and serial3.zip uses overlapped.
Both write the data to COM1 and read the data from COM2.
The werid thing is:
if I first time run serial.zip, it worked fine, it read one character "1" from COM2.
After that, I run serial3.zip, it worked fine too, it read one character"T" from COM2.
Then I was back to run serial.zip, now the problem existed, seems it was always waiting for character in input buffer of COM2.
It might be something left in the serial port after running serial3.zip. I don't know that. I used PurgeCom() functions, but it didn't work at all.
Both used quite basic lauses about serial port, but their comments are a little bit mess. Sorry for any inconvenience.
I would apprecate that very much if someone could take a look at them. Maybe I did something stupid, but I really want to know that.
Thanks
Serial3.zip used some functions created by Codeplug.