4
\$\begingroup\$

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.

\$\endgroup\$
5
\$\begingroup\$

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.

\$\endgroup\$
  • \$\begingroup\$ Thanks for you answer. Can SPI work too? \$\endgroup\$ – echo_salik Aug 4 '15 at 10:21
  • \$\begingroup\$ 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. \$\endgroup\$ – tehwalris Aug 5 '15 at 13:41
  • 2
    \$\begingroup\$ As I see, Atmel 89C52 does not have SPI interface either, only UART. \$\endgroup\$ – Bence Kaulics Aug 5 '15 at 14:04
  • 1
    \$\begingroup\$ @BenceKaulics Thanks for point that out, I have made correction. \$\endgroup\$ – Arjun Aug 5 '15 at 18:13
2
\$\begingroup\$

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.

enter image description here

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

enter image description here

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

\$\endgroup\$
  • \$\begingroup\$ 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. \$\endgroup\$ – echo_salik Aug 4 '15 at 15:38
  • \$\begingroup\$ This info actually came in handy in another project I have. Thanks man. Saved me $$$ :) \$\endgroup\$ – echo_salik Aug 6 '15 at 7:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.