PDA

View Full Version : Do I need MAX232 for Serial Comms



koossa
- 10th October 2005, 13:22
Good day

What is the difference between using the Max232 for serial comms or just directly via resistor to a pic's PIN?

In the PicBasic Pro Compiler manual it shows at the serout and serin to connect it from the PC's serial port to the PIC's pin and it is working good.
Why do some people use MAX232 for this?

Dwayne
- 10th October 2005, 14:34
No, you do' tneed a Max 232 for Serial Communication. If you don't use one, you will need to invert your signal so your PC will be able to read it. Max 232 makes things a lot nicer.

Make sure you start out with a SLOW baudrate, and establish communication first! 1200, 2400 is a good start.

Dwayne

koossa
- 10th October 2005, 14:39
What exactly is it that the MAX232 make nicer?

sean-h
- 10th October 2005, 16:58
Nicer means

The Max232 is a RS232 Signal to TTL converter.

Your PC serial port runs with a voltage range of 10+/-10 or higher and the voltage your Pic is running at is typically 5Volts.
So the max232 drops the serial data voltage coming from the serial port to TTL levels and then increases the voltages coming back from your Pic to RS232 levels.
Also the Max232 Inverts the signal, so you do not have to do this PC side in your software.

The pic chip can handle the RS232 levels with resistors inline but you would only be able to use the Serin commands as these will receive Non Inverted data and your max speed would be 38400baud. You can get it higher using a bit bang routine but error% goes up.

If you were using Hserin commands and using the built in Uart of the Pic then you will need the bits inverted so a Max232 would be better and correct levels are also guaranteed.

I saved the cost of a Max232 on one circuit i layed up, by using a Transistor for the data coming from the serial port which would also inverted it and then had a spare gate on a 74hc04(Inverter) which was also already in the circuit, which I used for data going back to the PC. Ran at 115200baud using hserin fine.

Regards

Sean.

koossa
- 10th October 2005, 17:10
Thank you Sean!!!!