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

Using RS232 without a MAX232 chip

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







Using RS232 without a MAX232 chip
PostPosted: Tue Aug 23, 2005 9:40 am     Reply with quote

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!
asmallri



Joined: 12 Aug 2004
Posts: 1635
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Tue Aug 23, 2005 10:01 am     Reply with quote

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!!
SherpaDoug



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

View user's profile Send private message

PostPosted: Tue Aug 23, 2005 10:02 am     Reply with quote

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.
Ttelmah
Guest







PostPosted: Tue Aug 23, 2005 10:33 am     Reply with quote

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
kender



Joined: 09 Aug 2004
Posts: 768
Location: Silicon Valley

View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger

PostPosted: Tue Aug 23, 2005 10:48 am     Reply with quote

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.
DK_TA
Guest







PostPosted: Tue Aug 23, 2005 1:08 pm     Reply with quote

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
DK_TA
Guest







PostPosted: Tue Aug 23, 2005 1:25 pm     Reply with quote

Ok, I need more help Embarassed

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?
newguy



Joined: 24 Jun 2004
Posts: 1908

View user's profile Send private message

PostPosted: Tue Aug 23, 2005 1:42 pm     Reply with quote

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.
Barney



Joined: 18 Oct 2004
Posts: 41
Location: Newark, CA

View user's profile Send private message

PostPosted: Tue Aug 23, 2005 2:04 pm     Reply with quote

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.
rnielsen



Joined: 23 Sep 2003
Posts: 852
Location: Utah

View user's profile Send private message

PostPosted: Tue Aug 23, 2005 2:56 pm     Reply with quote

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. Twisted Evil

Ronald
kender



Joined: 09 Aug 2004
Posts: 768
Location: Silicon Valley

View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger

PostPosted: Thu Aug 25, 2005 1:53 pm     Reply with quote

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
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