i want to communicate between two microcontrollers(89c51 ) using RXD & TXD pins, P3.0 and P3.1 respectively. should i need to connect TXD of Transmiter 89c51 with RXD of receiver 89c51 and vice -versa directly or should i use two MAX232 chips for communication.
please help
waiting for reply
neelam
As long as the power supplies are the same, you can connect the pins directly without using any drivers like max232. But it is sometimes dangerous if the 8051's are powered by 2 diff sources. A cheaper way is the use a TTL open collector gate to act as a buffer.
As a thumb rule, whenever I have both the 8051's powered by the same VCC, I connect pins directly and when I have diff sources, I use a TTL OC gate in between.
If they are in the same circuit and powered by the same source, connect the pins together.
If they will be in different circuits, and connected through cables, then use interface IC's.
Although, technically speaking, you don't need any drivers, but I would use 232 interface. And the reason is that if you encounter any problems with your software at one or the other end you will be able to connect your PC or laptop or any other port analyser and "see" what your microcontrolleres are trying to send/receive.
Once your system is running smoothly you can remove (or leave) 232 drivers.
Regards,
IanP
Also with different PSU's I would not put RS232 converters in between, just use
a protection resistor in each dataline.
The value depends on the distance (length of cable) you work with and the speed
of communication, but I would use 1k for 'on the bench' and about 120 ohm if you
span some meters.
RS232 officially will span 15 meters, but 50 can be reached if your baudrate is not
to high.
You could also use RS485 device. For example I use Max485 to make 2 pic communicating both if they are on different boards with diferent power supply or if they are lying on the same board.
I think it would be very simple using I2C protocol to make communication instead of using TX and RX pins if MCU are on the same board.
Check if your MCU has an internal I2C HW.
You could also use RS485 device. For example I use Max485 to make 2 pic communicating both if they are on different boards with diferent power supply or if they are lying on the same board.
I haven't got a simple schemtic to upload now. i'll tell you in few words.
i use SN75176(texas) or max485(maxim) interchangeble.
You have to use Hardawre or software uart of PIC. connect TX(usually RC6) to PIN 4 of rs485 chip and RX(usually RC7) to PIN 1 of max485. Also I usually control TX(pin 2) and RX(pin 3) enable together by another PIC's Port(whatever).
Pins 5 and 8 are for power supply. and pins 6 and 7 (A, B) are for rs485 bus(all on the same line and all B on the other bus line). You have to connect all of your max485 in the same way.
To send or receive data is the same of simple rs232.if you use to program in C you can Use commands PUTC() or Printf() to send characters or strings.
and command kbht() and GETC() to control if byte has been received.
I think it would be very simple using I2C protocol to make communication instead of using TX and RX pins if MCU are on the same board.
Check if your MCU has an internal I2C HW.