Subj : Re: DTR Output on COM port To : borland.public.cpp.borlandcpp From : Bill Date : Sat Jul 30 2005 03:00 pm "Jack Sawatzky" wrote in message news:42e99481@newsgroups.borland.com... > > >One thing you're doing wrong is looking at DSR, which is an input :-) You > >might have better luck with pin 4 on a 9-pin connector, or pin 20 on a > >25-pin connector. > > > >HTH, > >Bill > > > > > > > > > Hi Bill, > Actually I made a mistake in my query. It IS pin number 4 on the DB9 > that I was > monitoring with my meter, and getting nothing but 0 volts. So the > basic question > remains. > Jack Ok then - moving on to the code... Your code looks fine to me, very similar to code I use to explicitly control the DTR line. For what it's worth, here is where my code differs from the code you show: 1) I use FILE_ATTRIBUTE_NORMAL rather than 0 for the dwFlagsAndAttributes parameter in the CreateFile call. 2) I check the return from CreateFile against INVALID_FILE_HANDLE (though I assume you do too). 3) I call CloseHandle when I'm done (I assume you do too). 4) I don't bother with GetCommState or SetCommState if I'm only interested in controlling the DTR line. 5) If I do use the DCB (because I want to use the port for comms at the same time) then I set the fDtrControl flag to DTR_CONTROL_DISABLE. I don't know which, if any, of these differences might affect the effectiveness of your code. Finally, I'm _still_ suspicious of your voltage measurements. Every PC comms port I have looked at swings positive and negative at the output pins (typically +/-12V) rather than zero (required by RS-232?). Zero suggests either you are not making a connection, or you are not looking at an output. HTH, Bill .