View previous topic :: View next topic |
Author |
Message |
edi
Joined: 22 Dec 2003 Posts: 82
|
Software RS232 - Max frequency |
Posted: Sun Nov 28, 2004 7:14 am |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah Guest
|
|
Posted: Sun Nov 28, 2004 7:42 am |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
edi
Joined: 22 Dec 2003 Posts: 82
|
|
Posted: Sun Nov 28, 2004 8:45 am |
|
|
Thanks for your reply. |
|
![](templates/subSilver/images/spacer.gif) |
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Sun Nov 28, 2004 9:05 am |
|
|
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. |
|
![](templates/subSilver/images/spacer.gif) |
edi
Joined: 22 Dec 2003 Posts: 82
|
|
Posted: Mon Nov 29, 2004 1:32 am |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Mon Nov 29, 2004 9:42 am |
|
|
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. |
|
![](templates/subSilver/images/spacer.gif) |
SherpaDoug
Joined: 07 Sep 2003 Posts: 1640 Location: Cape Cod Mass USA
|
|
Posted: Mon Nov 29, 2004 11:13 am |
|
|
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. |
|
![](templates/subSilver/images/spacer.gif) |
|