Hi.
Does anybody have an example on have to control the pins on the serial port thru API (not using MScomm) in VB 6.
I realy need this, since I need to be able to have TOTAL control of ALL the pin on the com port.
Printable View
Hi.
Does anybody have an example on have to control the pins on the serial port thru API (not using MScomm) in VB 6.
I realy need this, since I need to be able to have TOTAL control of ALL the pin on the com port.
What are you mean by "control the pins"? I'm curious as to what you want to do.
If you're talking about individually managing what's going on with the pins, I _think_ that's even below API stuff, it's hardware. Not to mention is might be RJ45's, 11's DB9's or 25's or whatever, and that usually at least one wire is a ground.
For a very simple application, you can even just have one wire - transmit on one end and receive on the other.
HI.
I need to be able to control TXD, DTR, DSR, RTS and CTS separetly, without them turning one or the other on or off, I know this can be done in Delphi and C++ (dont know how) but should it not be possible in VB6, there must be another way than using the MSComm ??
That makes sesnse. When I first read "pins" I was thinking pin 2, 3 etc.
I'm sure the communications control is way too high level for that, wish I knew if there were Windows API calls or if you have to communicate with the driver. I have a book, Serial Communications that talks about that type of stuff, it's using C++. Unfortunately, I'm on the road and won't be home until next week.
If this thread is still at this point then, I'll see what I can find.
Hi Mike.
I would REALY like your help, since I'm stuck here at the moment, so I won't close this thread unless someone has another GOOD answer for me.
I'll try my best, but can't promise anything :)
It's just plain interesting to me, so I want to figure it out. For some reason, I'm fascinated by com ports. Still trying to get the guts up to put my tounge against one to see if I get shocked when data is sent.
I won't be home (have access to my book) until at least Saturday. But in case you're near a book store, it's called "Serial Communications", can't remember the author.
Hi
I found some more info, it's some of these API's we need:
CreateFile -> To open the COM port
SetCommState (to set the state of some signals)
GetCommState (to get the state of some signals)
CloseHandle -> to close the serial port
But we need more, we need something to configure the port DCB
Finally got my book. Now, I'm just reading some stuff, don't know enough about it to explain. I _think_ a reference like this is what you need. The book is called "Serial Communications Developer's Guide" second edition by Mark Nelson. ISBN 0-7645-4570-1. It cost me about $50. This was published in 2000, might be a later edition.
Anyway, when you say you need to "configure the port DCB", this book explains all that, has example source code etc. Apparently, once the DCB structure is filled out, you pass it to some of the functions in the win 32 API, like SetCommState().
The DBC structure is quite a beast, with about 24 members. This particular book has some wrapper classes that claim to make it easier on the programmer.
MSDC has a lot of info also, starting around http://msdn.microsoft.com/library/de..._resources.asp