Serial Port communication
-
Hi all, this is my first time using port communcation, so I am a bit confused. I have read the msdn and several articles, but I still don't understand exactly how to do what I want. Basically, I have a peripheral on my machine that I want to send messages to and receive messages from. I downloaded the CSerialCom[^] library from codeproject, so reading and writing is not a problem. The problem is that the system requires programatic-management of control flow mechanish (DTR/DSR), which means that I must assert the DTR to get the peripheral's attention, and then I must wait for the DSR assertion before I can transmit data. Can someone provide a demo that shows how to communicate with a peripheral with these contraints? Thanks, ----------------- Genaro
-
Hi all, this is my first time using port communcation, so I am a bit confused. I have read the msdn and several articles, but I still don't understand exactly how to do what I want. Basically, I have a peripheral on my machine that I want to send messages to and receive messages from. I downloaded the CSerialCom[^] library from codeproject, so reading and writing is not a problem. The problem is that the system requires programatic-management of control flow mechanish (DTR/DSR), which means that I must assert the DTR to get the peripheral's attention, and then I must wait for the DSR assertion before I can transmit data. Can someone provide a demo that shows how to communicate with a peripheral with these contraints? Thanks, ----------------- Genaro
-
-
Thank you for your response. However, I still don't understand how to set the DTR high before monitoring for the DSR flag. Could you please explain that? Thank you, ----------------- Genaro
I think that you have null modem connection. DTR -> DSR are continual signal. When you set DTR signal on high that means you are redy to send data but when your DSR become high that mean you can receive data from device. When you start to configure port set DTR signal with DTR_CONTROL_DISABLE and fDsrSensitivity in DCB with TRUE to avoid flow, but watch all changing are valid after calling function SetCommState. Now you can control DTR with function EscapeCommFunction and monitoring DSR. My recommmendation is whenever use EscapeCommFunction(hFile, CLRDTR | CLRRTS ) or EscapeCommFunction(hFile, SETDTR | SETRTS).