RS-232 Serial port Communication?
-
Iam using VC++ as a fonrtend software to communicate with embedded system through Serial communication(RS-232). Iam using Readfile and Writefile functions to read and write through COM port. Can anyone Clarify me the following, * Is it necessary to Flush the Input and Output buffer for every command being transmitted/received ??? * If not, how often should i Flush the input and output buffer ??? Madhu
-
Iam using VC++ as a fonrtend software to communicate with embedded system through Serial communication(RS-232). Iam using Readfile and Writefile functions to read and write through COM port. Can anyone Clarify me the following, * Is it necessary to Flush the Input and Output buffer for every command being transmitted/received ??? * If not, how often should i Flush the input and output buffer ??? Madhu
Hello. I think you should flush the buffers after every Writefile. Else, chances are that the data will remain in the write buffer. When you do a flush, the data will be sent to the device. There is (generally) no need for flush before Readfile. You might considder to search for a serial class. There are several here at CP. I have found them very useful over the years. Kakan