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

Can I use built in uart 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
Guest








Can I use built in uart without a max232 chip?
PostPosted: Sun Feb 06, 2005 11:55 pm     Reply with quote

Do I have to use a max232 chip for serial port when using the built in rs232?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Feb 07, 2005 1:00 am     Reply with quote

You must, if you're going to talk to a PC or some other device that
has a MAX232-equivalent inside it. That's because the hardware
UART doesn't have an "invert" option.
Ttelmah
Guest







Re: Can I use built in uart without a max232 chip?
PostPosted: Mon Feb 07, 2005 5:53 am     Reply with quote

Anonymous wrote:
Do I have to use a max232 chip for serial port when using the built in rs232?

It is important to understand what is going on. 'RS232', is actually a decription of a signalling _voltage_ standard. The UART in the PIC, generates an asynchronous data stream, using the CMOS 'logic' voltage levels, which can be sent over wires using a number of different voltage standards. You can (for instance), send it over RS485, with the required 'transciever' chip for this, or over 'RS232', using a transceiver like the Maxim chip.
Now many PC's (especially laptops), no longer genuinely use 'RS232' levels, but use 'trimmed' subsets of the standard, with lower voltages. You can use a much smaller transceiver than the MAX232, to generate this type of signalling, and for short distances, this will work fine (look at the DS275 for an example). You can also use a simple logic gate as an inverter, and with a few resistors, generate a signal, that 'may' work over similar distances. Alternatively, if wanting to drive multiple devices over longer distances, RS485 transmission is the better bet. However to just talk between two PIC's on the same board, it'll normally be simplest to use no transceiver at all, and just directly connect the signals.
So there are a lot of different possible connection forms that may be used, and which one you will need to use, will depend on your application. The RS232 transceiver, is the commonest solution, especially when talking to a PC, but it is not the universal answer...

Best Wishes
valemike
Guest







PostPosted: Mon Feb 07, 2005 8:01 am     Reply with quote

i did once use ccs's software-based uart functions to communicate between two PICs separated by a foot-long cable, and w/o a MAX232

I let rx and tx be RC3 and RC4 when I couldn't get i2c working. It sure worked, but i had to make one of the PICs sample very frequently. So yes, you can do it without a MAX232, and on other pins, but i didn't find it practical to use, especially when i finally got i2c working.
SherpaDoug



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

View user's profile Send private message

PostPosted: Mon Feb 07, 2005 9:12 am     Reply with quote

I once used software UARTs at TTL levels to communicate over nearly a kilometer of twisted pair. Fortunately I only needed 300 baud and the system was on the bottom of the ocean so there was no electrical noise to speak of.
It all depends on the environment and error tollerance.
_________________
The search for better is endless. Instead simply find very good and get the job done.
hsamuels
Guest







RS232 with inverters and resistors
PostPosted: Tue Feb 08, 2005 7:17 am     Reply with quote

You do have to invert the signals, but you don't need to use the official RS232 voltage levels. That means you can use a couple of spare inverters from a 74HC04, for example.

The PIC's Tx pin goes to an inverter input. Put a 1k resistor from the output of the inverter to pin 2 of the DB9 connector. If you have extra spare inverters, you can put them in parallel to increase the drive strength.

Pin 3 of the DB9 should have a 20k resistor to the input of another inverter. The output of that inverter goes to the Rx pin of the PIC. The resistor protects the inverter from the RS232 voltage levels coming in.

Remember to ground pin 5 of the DB9 connector.

Also, you can put a 4.7M pulldown resistor from pin 3 of the DB9 to ground. This pulls the signal down when the cable is unplugged.

I use this all the time, and my current application is running at 115.2 kbaud with no problem.
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