2 x Atmega328

I am making a big project here at my home and my conception is that i will make it with a processor (Atmega328) and secondary processor (Atmega328).My question is : when i connect the RX from the one Atmega328 to the TX of the other and the TX of the first to the RX of the second - qould they read for example strings from each other, do i need to connect it through a resistor or just directly.Please help - had someone done it already ?

You can connect them directly. You also need to connect GND between the two 328s.

If you are programming them with the regular bootloader you will have to disconnect anything from the Rx an Tx pins first.

Another possibility is to use SoftwareSerial to create a serial port on some other pins.

You may find the examples in serial input basics useful.

...R

Yes but it is absolutely possible that the one atmega328 sends a string or just a character and the other just recieves it, right ?

iliyancho57:
Yes but it is absolutely possible that the one atmega328 sends a string or just a character and the other just recieves it, right ?

Yes, that is what I intended by my pervious reply. Use the appropriate code example in serial input basics to receive the data.

If you have two Arduinos it would be a good idea to do your testing with them before you make a special purpose device.

And if you can actually operate your project with a single Atmega 328 you would make the task a lot easier.

...R

Tell me about this softwara - how can i create another RX and TX and how does the arduino make the difference between them - for example the arduino mega - how does it know to send data to RX0TX0 or RX1TX1 ?

iliyancho57:
Tell me about this softwara - how can i create another RX and TX and how does the arduino make the difference between them - for example the arduino mega - how does it know to send data to RX0TX0 or RX1TX1 ?

You need to read the Reference pages for SoftwareSerial

The Mega is different from the Uno and the Atmega328 because the Mega has 4 HardwareSerial ports and you are very unlikely to need to use SoftwareSerial with it. If you read the Reference pages for Serial you will see how to use the ports on the Mega

...R

ok.you explain it very good.When i make some pins into RX and TX can i make them normal again?

iliyancho57:
ok.you explain it very good.When i make some pins into RX and TX can i make them normal again?

Exactly what do you mean?

iliyancho57:
ok.you explain it very good.When i make some pins into RX and TX can i make them normal again?

On an Arduino Uno you can use the Rx and Tx pins (pins 0 & 1) as normal digital pins, but it's not recommended, as it will interfere with uploading sketches.
If you're using other pins as your Rx & Tx, uploading a new sketch will reset those pins.
Within your sketch, it depends on the program. I believe it may be possible.

iliyancho57:
ok.you explain it very good.When i make some pins into RX and TX can i make them normal again?

The way the pins are used depends on whatever program is loaded. Programs do not make permanent changes to the Arduino.

As @HenryBest has said you should not use pins 0 and 1 for anything (at least not while you are a beginner).

If you assign other pins for use with SoftwareSerial it would be possible to stop SoftwareSerial and use the pins for something else but you should NOT do that until you have a LOT more experience. You will just get into a mess.

@iliyancho57, you have been asking a lot of very short questions. You would probably get a lot more useful information if you explain what you are trying to do.

...R