jtroxas wrote: I am finding myself wanting to repeat Olin's rant about people not wanting to answer relevant questions. :) > no just the 4-5 last bytes... I think its in the way I'am clearing\setting > the RTS\CTS lines in the pic and PC ie.. I am doing it too early both from > the PC and PIC side( Iam doing RTS\CTS manualy in code immidiately after > the last byte is written to the USART TXREG PIC side and similar thing on > the PC side)... That's definitely the wrong way to do it. If you absolutely *need* to use handshaking lines, you disable the line only after you check the flag that tells you the message was sent, not after you put your last byte into TXREG. > but since it takes time for the data to be shifted out from the > USARTshiftregisters and the data from TXREG be sent to the output > shiftregister to be again shifted out and sent to the PC.. the PC will > never received the 2 last bytes in the PIC's USART transmit buffer(TXREG > and SHIFT REgister) because the signal that say Finished Transmitting is > already seent just after writing the last byte to TXREG... the same thing > happens from the PC side when transmitting so another 2-3 bytes is lost > from the PC transmit buffer.. Are you controlling the PC handshake lines *directly*? > I think the solution is to add some waiting time before setting/clearing > RTS\CTS(make sure that buffers are really empty).. but waiting a few > milliseconds is a little costly(PIC is doing nothing) so I managed to try > a hack and just add some null bytes to the end of every data I send, > expecting that it will be trimmed out.. and remove the waiting code.. > after all I am using interrupts for Transmit and receive.. Sounds like an ugly hack. Read the datasheet -- you have two useful flags at your disposal, which tell you exactly when the TXREG or the TSR registers are empty. Namely, the TXIF and TRMT flags. Vitaliy -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist