What are the hardware precaution to be taken for interfacing a PC serial port (rs232) with a microcontroller ? , is there a need for using an optocoupler for isolating the micro from the serial line ?
Opto is always nice for ultimate safety but not really needed. You can send from micro direct to PC but not from PC to micro as this is +-12v. You need to remove the - and clamp 12 to 5v. You can google for simpler circuits rather than MAX232 if you want, but the max is a good option as well.
The RS232 serial port on a PC uses +3 to +25 volts to signify a logic level of 0, and -3 to -25 volts to signify a logic level of 1.
In order for the PC and a microcontroller to successfully communicate some logic level translation is necessary.
There are many companies that manufacture modules that take care of the required logic level translation. The MAX 232 To RS232 Converter is one such module.....
ok , i already have a board with the rs232 (max) on it , but i fear , that can it make any problem to my PC , so i asked , I earlier interfaced parallel port with an optoisolator
Max232 for sure.
If you give a look at the datasheet, you will read somewhere stating that the EIA-RS233 (or V.24) must allow short circuit on its lines.
So the MAX232 is your best choice.
If I'm not mistaken, there is even a newer IC, MAX2323, that has all the boost capacitors built-in, making your hardware neater and cleaner.