CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

RS232

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Einly



Joined: 10 Sep 2003
Posts: 60

View user's profile Send private message Send e-mail Yahoo Messenger MSN Messenger ICQ Number

RS232
PostPosted: Thu Dec 30, 2004 9:22 am     Reply with quote

Dear all,

I am using PIC16f876 to send serial data to a computer. I am using hardware UART.

1) Before I write to TXREG Register, I will check bit 1 of the TXSTA. Since there is no handshaking line on the PIC (DTR/RTS), I just connect the CTS and the RTS of the 9 pin cable together. May I know when the data in the TSR REGISTER be transmitted out since the 2 line have been connected together? Will it been sent although the pc part have not ready to read it?

2) What is the usual size of the serial port buffer in the computer? Can it be set? If the serial port buffer is full, will the data be lost?

3) If the data lost happens, what is the common practice? Is it by introducing hardware handshaking or keep on polling the data in the pc part?

4) If it is to introduce hardware handshaking, how to do in using PIC16f876 since it has not these 2 lines (RTS/CTS)? I do not do software handshaking because this will slow down the system.


Thanks a lot
_________________
Einly
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Thu Dec 30, 2004 9:43 am     Reply with quote

You can give the PIC DTR & RTS lines if you want them, though most PC programs don't use them anyway. Just run them through a RS232 level shifter (like a MAX232) just as you do the TXD and RXD lines and run them to port pins. It is then up to your PIC software to query and drive them.
My programming is fairly primitive and I assume the PC buffer is big enough to swallow a whole PIC packet, which rarely exceeds 16 bytes, and that the PC will have read it and disposed of it by the time my next packet is ready.
For data comming into the PIC I usually parse and execute it byte by byte as it comes in. I don't buffer it at all unless I want to parrot back a bad command for debugging.
_________________
The search for better is endless. Instead simply find very good and get the job done.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group