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

Software RS232 - Max frequency

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



Joined: 22 Dec 2003
Posts: 82

View user's profile Send private message

Software RS232 - Max frequency
PostPosted: Sun Nov 28, 2004 7:14 am     Reply with quote

I'm using 16F88 and can't use the MAX232 (space/power).
So I belive that I must use the S/W UART with INVERT instead of the H/W one. am I right?
If yes, what is the max frequency that I can get with the S/W UART?

Edi
Ttelmah
Guest







PostPosted: Sun Nov 28, 2004 7:42 am     Reply with quote

Depends on your clock rate, and the rate chosen.
There is a granularity imposed by the instruction time. So if (for instance), you selected a rate of 115200bps, on a chip running at 1MHz, given the instruction time is 4uSec, and the required 'bit time' is 8.68uSec, even if the code could manage to retrieve the data in this short time, and get it out the port (it can't), the nearest it could possibly get, would either be 8uSec/pulse, or 12uSec/pulse. The 8usec example, would still be over 8% in error, which is more than is normally acceptable for RS232 (4% as an 'absolute worst case', is a good guide). In fact the transmit code, needs a minimum of about 8 instructions per bit (so with the 1MHz clock, you could probably handle 31250bps, but trying to do 38400, would hit both the granularity error, an the speed of the CPU...). If you reckon on perhaps 1/30th the clock rate, as an upper limit, and ideally select a crystal, that is a multiple of the baud rate, you will get good results (so you will get a more accurate 19200bpsreproduction, with a 3.6864Mhz crystal, than with a 4MHz unit). The accuracy of the receive code degrades earlier than the transmit code, so reckon on preferably allowing perhaps 15 instruction times for this. 57600bps, on a 3.6864MHz crystal woks fine both ways.

Best Wishes
edi



Joined: 22 Dec 2003
Posts: 82

View user's profile Send private message

PostPosted: Sun Nov 28, 2004 8:45 am     Reply with quote

Thanks for your reply.
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Sun Nov 28, 2004 9:05 am     Reply with quote

Quote:
I'm using 16F88 and can't use the MAX232 (space/power).
So I belive that I must use the S/W UART with INVERT instead of the H/W one. am I right?


If you are connecting to another device that is expecting logic levels then there is no need for the MAX232 (PIC to PIC). However, if you are connecting the PIC to a device that is expecting RS232 voltage levels (like a computer) then you might need one depending on the computer. Some can get away without it while others won't work. Search the forum and you will find some other alternatives to the MAX232.
edi



Joined: 22 Dec 2003
Posts: 82

View user's profile Send private message

PostPosted: Mon Nov 29, 2004 1:32 am     Reply with quote

Mark,

I connect the PIC to another controller (but it's like a black box and I don't know what's the controller). In the controller's data sheet it says that there is no need for RS232 level shifter. So the question is if there is a need for invert or no?

Edi
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Mon Nov 29, 2004 9:42 am     Reply with quote

I cannot really comment on that without knowing what the other device is. Now if the data sheet says that one can be used but is not required then I would say you need the invert. If this "black box" can be connect to a PC then I would also say that you need the invert.
SherpaDoug



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

View user's profile Send private message

PostPosted: Mon Nov 29, 2004 11:13 am     Reply with quote

You could check the quiescent state of the serial line from the black box. If it is true RS232 the line should rest low or negative. If it rests high it is inverted serial.
_________________
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