Make Arduino and 89C52 talk to each other

I am trying to create a project in which I am required to make Arduino and Atmel 89C52 talk to each other.

I know this can be achieved via UART but the problem is my Arduino is already using its TX/RX ports. Is there a way to make them talk by any other means? Like I2C or SPI interface? Would soft UART suffice? The whole project depends on then talking to each other effectively.

It is absolutely possible to make them talk :) Arduino has a feature for multiple RX/TX communications. It can be accomplished with Software serial. As far as connecting Arduino with 89c52 with I2C is concerned, it is only possible when you write I2c protocol from 89c52 side (AT89C52 doesnot have hardware I2C port).

So if your Serial port of Arduino is occupied by any other device, you could change that pin to software serial (meaning transfer the purpose to other pins) and use that serial port for making communication with 89c52.

EDIT

Yes you can use SPI interface, but that is not my choice ;) since it requires 3 wires and is only intended for short distances. And also you need to have At89s52 not at89c52.

• Thanks for you answer. Can SPI work too? – echo_salik Aug 4 '15 at 10:21
• Using hardware SPI, instead of soft UART, will mean less CPU load for the Arduino. The OP mentioned efficiency - if he meant CPU time efficiency, hard SPI might be a better choice. – tehwalris Aug 5 '15 at 13:41
• As I see, Atmel 89C52 does not have SPI interface either, only UART. – Bence Kaulics Aug 5 '15 at 14:04
• @BenceKaulics Thanks for point that out, I have made correction. – Arjun Aug 5 '15 at 18:13

With additional hardware you could switch the Arduino's UART lines between the Atmel 89C52 and the other device. These hardwares are called multiplexers, and by some control pins it is available to swap between analog or digital lines. This way you could communicate only with one device at a time, so if it is a problem then stick with the software serial.

To give an example let's see CD4052B

It is a Differential 4-Channel Analog Multiplexer/Demultiplexer, which means that it can swap two lines (RX,TX in your case) between four different devices.

You connect RX and TX to X-COM and Y-COM and by A and B switch between the devices.

A devices/channel could be selected according to the table above.

• Thanks for the reply. Yes devices needs to be working parallel, so I cant use this. But that's the first time I heard about this method. Thanks. – echo_salik Aug 4 '15 at 15:38
• This info actually came in handy in another project I have. Thanks man. Saved me \$ :) – echo_salik Aug 6 '15 at 7:25