ATMEGA328 mutliple serial ports

Hello,

I am new to the Arduino, so I am still learning. I noticed on the serial reference page it indicated on the Arduino Mega that you could have multiple serial ports. Does the ATMEGA328 fall into the same category? If not, is it possible to use more than one serial port? Such as->

Serial1.begin(speed) Serial2.begin(speed)

Thanks,

-renasis

The Mega has 4 hardware based serial ports. The Duemilanove has 1 hardware based serial port.

You can use NewSoftSerial and a pair of digital pins to create a software serial port. More than 1 software serial port can be done, but only one can be active at a time. If you have defined 2, and the 1st is active, the 2nd can't receive data. Requires careful design to use more than one software serial port.

If you really need more than 2 serial ports, either get the Mega or re-think the design.

@Paul: could it be that you mistake the ATMEGA 328 with the Arduino Mega?

@Renasis: the Atmega 328 has only one hardware serial port. If you need more serial connections you have to use “software serial”.

Udo

Thanks for the replies. I only need qty. 1 hardware serial port. I will also need qty. 1 software serial port. What would be the best way to do this on the ATMEGA328?

Thanks,

-ren

You can also use the Sanguino, it has 2 serial ports

http://sanguino.cc/

Mark

Gee, a Google search for "arduino software serial" gives as it first choice: http://www.arduino.cc/en/Tutorial/SoftwareSerial which looks like the right place.

David

Only problem is that SoftwareSerial is obsolete. NewSoftSerial is much better.

Yeah, thanks -- my point was that Google is a useful tool.

Best to start at: http://www.arduino.cc/playground/

and that leads to: http://www.arduino.cc/playground/Main/InterfacingWithHardware#Communication

And the fourth entry is NewSoftSerial at: http://arduiniana.org/libraries/newsoftserial (!)

:D