I'm thingking of setting DTR on from the PC side when connecting and then the device on the other end should reply by setting DSR on.. and keep them on while connected. just like a modem.. to detect a connection and sudden disconnection.. im thinking of always querying this pins before sending and receiving couple it with some error handling routine to tell if the cable is good or not. thanks everyone for all your inputs.. ----- Original Message ----- From: "Gerhard Fiedler" Newsgroups: gmane.comp.hardware.microcontrollers.pic Sent: Monday, October 23, 2006 5:40 AM Subject: Re: [PIC]RS-232 on the pc side > Genome wrote: > >>> Keep sending data suppose 0x55,0x01 and wait for response. >> >> My problem with the keep sending data is that there is no way of telling >> when the pic is suddenly disconnected in the middle of a communication.. >> i.e. the pic will just think that there are errors and no way of telling >> whether the error is due to cable disconnection or just transmission >> errors... I would like something like plugAndplay capability... > > Not even with DTR or any other signal you will be able to tell whether the > error is due to cable disconnection or transmission error (say a broken > cable or a pin with bad contact). > > Usually there is a problem that you should solve anyway when you have a > significant number of transmission errors (as in scrambled bits) in a > wired > short-range serial link. > > Even though you can, you probably shouldn't have to deal with additional > status lines. Sending out a "start of transmission" marker and waiting a > short time seems good enough to me, too. > > You also didn't say on what side you want to detect the presence of a > connected device. If you want to know at the PC side whether there's > something connected at the serial port, the PC's DTR output doesn't seem > to > be the one you need -- an input (CTS, DSR, CT) would probably be better > suited. > > Gerhard > > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist