how to send data to com-port? is it possible to send data to the soundcard like winamp does to play it? i mean data, that means that it isn't necessary that it is music data.
Use the CreateFile function with "COM1" as parameter : .data strCOM1 db "COM1" handleCom HANDLE ? .code INVOKE CreateFile strCOM1, GENERIC_READ or GENERIC_WRITE,1,NULL, OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL mov handleCom, eax Now you can read/write to the port with the ReadFile and WriteFile functions. You can modifiy the settings of the port (baud rate, parity check, etc) by using a DBC structure. See the Win32 help file for more info
ok, i can send data with this method, but how can i control every pin on com port, like only kind of activate pin 2, etc.?
I don't know if you can activate pins directly. I think only privileged code can access i/o ports. There is more info in chapter 22 of the Art of Assembly language.
Hey direct output to hardware I/O port should be done via a VXD, at least the WinIO .dll ;) (on win2k for sure) Besides serial ports use a serial protocol to Transmit and receive data, enableing individual pins is hard to do if not imposible (for all pins i mean) For such a "pin by pin" operation... paralel port are supposed to be used ;)
umm.. Some years ago I wrote some code to set the DTR on a selected COM-port. It was used to trigger a device that could for example turn on a light bulb.. It works fine in win32 too since it only uses simple in/outs. Tho with win2k and newer OS's it won't work since it's not a "Priviledged instruction". I think I've seen API's that could do it. Tho I'm not sure what name of it is? Any idea? =) Or do I have to solve it using vxd's? vxd's doesn't work in win2k anyways right? Well, I'd epreciate some help here since I'm thinking of switching to win2k soon =) //Phrekie