> I am working on a project where I have PIC devices on a RS485 half duplex (2 > wire) network with a master slave protocol, where the master is a PC > connected to an external RS232/485 converter. Data direction for the > converter is controlled with the DTR signal on the PC com port. > > I have made a DOS program handling this master/slave protocol without any > problems (mainly because I am using a self-developed interrupt driver for > the serial port). > > I am now converting this program to Windows and since I haven't got the time > (or the knowledge yet) to redevelop a serial port interface for Windows, I > purchased the Commx Active X component from Green leaf software. > > However, I can't get the half duplex RS485 communication to work properly. > The main problem is that Commx has an event for TX buffer empty, but not for > TX shift register empty in the UART. This is a common problem with standard UART drivers on PCs. I don't see what the Commx library is buying you here. You would get the same treatment from the native Win32 calls, which is probably what the Commx library accesses. Unfortunately, the transmitter empty information is not surfaced to the Win32 layer either. You therefore have to customize the existing device driver, or create a new that only does the things you need. This can be done, but messing with OS internals is not something the average programmer should try at home. There may be folks out there that provide "enhanced" device drivers that include this feature, but I don't know of any off hand. I have seen commercial products for other COMM devices, like the paralell port, so it might be worth looking around bit. Sorry for the unwelcome news. This may not help you much, but I did something almost like this once. The only difference is that the PC was embedded and not running any form of Windows. This allowed direct access to the UART from assembler, which does at least provide a bit indicating transmission is complete. Could the PC be embedded where you can control the HW directly. Another thought is to have the PC talk to a PIC via RS-232, then the PIC drive the RS-485 on behalf of the PC. You could still use DTR to signal that transmission from the PC will be over after the next pause, then have the PIC do the actual turn around sequencing and timing. ***************************************************************** Olin Lathrop, embedded systems consultant in Devens Massachusetts (978) 772-3129, olin@cognivis.com, http://www.cognivis.com -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.