View previous topic :: View next topic |
Author |
Message |
DK_TA Guest
|
Using RS232 without a MAX232 chip |
Posted: Tue Aug 23, 2005 9:40 am |
|
|
I've heard before that it is possible to do RS232 communication with a PC without using a MAX232 chip. I'm wondering if this is actually possible.
Thanks! |
|
![](templates/subSilver/images/spacer.gif) |
asmallri
Joined: 12 Aug 2004 Posts: 1634 Location: Perth, Australia
|
|
Posted: Tue Aug 23, 2005 10:01 am |
|
|
The max232 or equivalent is a level converter. Typically an RS232 port puts out voltages in the range of -12v to +12 volt. If you feed this straight into a PIC you will destroy the PIC. If you do not want to use a MAX 232 then you need some other form of level conversion hardware (diodes / resistors / transistors). If you are talking serial RS232 between PICS, and have no need for RS232 voltage levels then, in this case, you do not need level converters. _________________ Regards, Andrew
http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!! |
|
![](templates/subSilver/images/spacer.gif) |
SherpaDoug
Joined: 07 Sep 2003 Posts: 1640 Location: Cape Cod Mass USA
|
|
Posted: Tue Aug 23, 2005 10:02 am |
|
|
A lot depends on the RS232 device being used. If the RS232 device follows the exact letter of the spec then no, you need a level shifter chip.
But many devices, especially laptops, cheat on the RS232 spec. The spec says that one of the states, Mark I believe, has to be a negative voltage; and the other state can go as high as +15V. The bare PIC has no way to create a negative voltage, and connecting +15V to a PIC pin is courting disaster.
Many laptops however will accept near 0V as a Mark and they don't drive their outputs beyond 5V. This allows you to connect a PIC output pin directly to the RS232 input, and use only a limiting resistor between the RS232 output and the PIC input.
The level shifter chips also invert the signal so you will need to use the invert option in the use-RS232 compiler directive, and that only works with software UARTs.
Yes it is possible under certain circumstances, between certain devices, over short distances, at low speeds. It is not recommended for beginners. _________________ The search for better is endless. Instead simply find very good and get the job done. |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah Guest
|
|
Posted: Tue Aug 23, 2005 10:33 am |
|
|
Yes. There are a number of different possible approaches, as have been already outlined. Two that fall between the 'resistors only, with software inversion', and the full buffer, are respectively to use a diode and capacitor to store some of the voltage from one of the other RS232 handshake pins, with a couple of transistors to provide the inversion in each direction - this is probably the cheapest, but can be quite bulky in parts, or to use the DS275, which is the trick used in many of the laptops, which are not quite following the spec... This chip, develops about -4.4v, using a charge pump, and has a single buffer for each direction, all in a 8pin DIL/SO8 package. This is fine for short RS232 links (up to perhaps 3m, it can just about meet the specification, of -3v on the line), ad is about the smallest 'better' solution.
Best Wishes |
|
![](templates/subSilver/images/spacer.gif) |
kender
Joined: 09 Aug 2004 Posts: 768 Location: Silicon Valley
|
|
Posted: Tue Aug 23, 2005 10:48 am |
|
|
I remmember lookig closely at the BASIC Stamp a couple of years ago. It didn't have a MAX232 or such. Instrean it had inverters on RX and TX, and it communicated to my laptops and PCs just fine. But it would be out of spec too. |
|
![](templates/subSilver/images/spacer.gif) |
DK_TA Guest
|
|
Posted: Tue Aug 23, 2005 1:08 pm |
|
|
Ah, thank you all for the help. It appears that since the MAX232 is so cheap, it will be advisable to go with that.
Since this is a project for students, having them not destroy their microcontrollers and serial ports on School PCs is a "good thing"
Just so you know, I'm designing a new lab for an Electrical engineering senior design class at a large university. In way over my head, but, ya know. ![Wink](images/smiles/icon_wink.gif) |
|
![](templates/subSilver/images/spacer.gif) |
DK_TA Guest
|
|
Posted: Tue Aug 23, 2005 1:25 pm |
|
|
Ok, I need more help
I am trying to watch the COM port, to make sure I am sending. I thought that the HyperTerminal program in WinXP did that, apparently I am wrong. Are there any good terminal programs left in XP? |
|
![](templates/subSilver/images/spacer.gif) |
newguy
Joined: 24 Jun 2004 Posts: 1903
|
|
Posted: Tue Aug 23, 2005 1:42 pm |
|
|
Hyperterminal does work.
A couple things to check though: I'm sure that you checked to make sure that the baud rate, # bits, hardware flow control, etc. are all set appropriately? One thing that has sometimes been an issue for me is that I set hyperterminal to the right settings, but on occasion I have also been forced to go into the configure hardware settings and change the settings of the com port there too. Not sure if that's a bug only with my computer, but like I said, sometimes I've had to do that too. |
|
![](templates/subSilver/images/spacer.gif) |
Barney
Joined: 18 Oct 2004 Posts: 41 Location: Newark, CA
|
|
Posted: Tue Aug 23, 2005 2:04 pm |
|
|
I have used the 10K resistor and inverted software UART trick on on a number of PIC projects to do serial comms with PCs. I have gone up to 9600 baud with a 25 foot cable and no problems. For me it has worked like a champ and I have yet to damage a PIC or a PC. |
|
![](templates/subSilver/images/spacer.gif) |
rnielsen
Joined: 23 Sep 2003 Posts: 852 Location: Utah
|
|
Posted: Tue Aug 23, 2005 2:56 pm |
|
|
Hook up something that you know does work, to the COM port. Once you've established that the settings are correct and the port is functioning then make a small program, in a PIC, that simply sends the same thing to the serial port over and over. If needed, get a scope and make sure that the PIC is sending the data and that it is making it through the MAX232 chip properly. Simple things like not swaping the RXD and TXD pins will bite the most experienced person in the butt as well.
Ronald |
|
![](templates/subSilver/images/spacer.gif) |
kender
Joined: 09 Aug 2004 Posts: 768 Location: Silicon Valley
|
|
Posted: Thu Aug 25, 2005 1:53 pm |
|
|
DK_TA,
Since you are putting together a lab for the students, you might find this thread about PICs in the academia interesting. http://www.ccsinfo.com/forum/viewtopic.php?t=23507
BTW, what university are you at?
Nick |
|
![](templates/subSilver/images/spacer.gif) |
|