I met a strange problem.
I am reading a serial I/O source code from other engineer. Actually,
there are many mistakes in his code but I still have to figure out why
the problem would happen.
Here is the situation.
The program would open a serial port and output 42000bytes.
The device connected to the serial port is a serial printer.
Although the program has many mistakes, it still can work well in some
kind of situation.
Generally, I would use "HyperTerminal" to check if the device is
connected well or not. (I press a key without stopping for few seconds
and check the printer. )
Then I execute the program to print a long strings....
But the printer stopped printing after printing about 10000bytes.
WriteFile return TRUE but mNumberWritten < mNumberHavetoWrite.
I try to use GetLastError()...and the error code is
"ERROR_INVALID_PARAMETER
". I dont understand why the program can transmit characters with
"INVALID PARAMETER" for a while.
However, if I did not use HyperTeminal to check communication, the
program can print all bytes.
Why the execution result was influenced by other software?
I also use a logical analyzer to get the waveform of transmission.
When I used this program, the TX signal would stop without any DSR or
CTS signal. When I used another program that I wrote by myself, the
TX signal worked well with the DSR signal. I think the problem might
be not caused by the printer.
Can somebody help me? This problem has confused me for several days.
The problem happended on COM1 (on board) and COM6 (PCI card, multi-
port serial adapters). I want to know why the program would act like
this.
ps. I have found that the program didn't change every necessay
parameter in "DCB" struct but I have solved it.
Regards.
by SelinaKuo.