Yeah, but you still have to turn off your transmitter when you receive. That's the whole point off the 2-wire half-duplex link. Bob Ammerman RAm Systems (contract development of high performance, high function, low-level software) ----- Original Message ----- From: M. Adam Davis To: Sent: Monday, August 21, 2000 8:59 AM Subject: Re: [PIC]: Commx with half duplex RS485 > You can leave the rs-485 converter open both ways (don't turn off the receiver > when you send). Your program will receive the data it is sending on the > network, and you can test for the last byte sent. Once you've received it, you > know the tx register is empty. But since you're leaving both tx and rx open on > the line all the time anyway, it's not important to worry about switching it. > > -Adam > > Ruben Jvnsson wrote: > > > > Hello, > > > > 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. It seems that the event for the TX buffer empty is fired after the last Transmit Register (FIFO) Empty Interrupt from the UART when Commx hasn't got anything more to write to the TX FIFO (when the FIFO is ready to receive new data but the last byte is still in the TX shift register). Thus, using this event for controlling data direction of the RS232/485 converter switches the converter from transmitter to receiver a couple of bits into the last character of the TX string which means that it isn't read properly by my receiving devices on the network. I have used the technique to append a dummy character (0xff) after my last significant character to make sure the last significant character is seen by my network devices and got the communication to work. But since the information about when! > the TX > > shift register is empty is a > > > > Has anybody successfully got this to work? Are there anybody else using CommX with Visual C++? > > > > The doc (helpfile) says that the port handle, accessible through CommX, is the very same handle returned from the CreateFile() Windows API function call used inside the PortCtl object. Can this handle be used to access registers from the UART directly? > > > > -- > > http://www.piclist.com hint: The PICList is archived three different > > ways. See http://www.piclist.com/#archives for details. > > -- > http://www.piclist.com hint: To leave the PICList > mailto:piclist-unsubscribe-request@mitvma.mit.edu -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu