I have a question regarding the number of ports of Duemilanove, since I'm kind of new to Arduino.
How many serial ports does Duemilanove has? I made a C program to communicate to Duemilanove (not using built-in serial monitor) but I need to connect another serial device to pins 0 and 1 (RX and TX respectively).
Is it possible to connect another serial device to these pins and still be able to use these ports to communicate to a computer?
Is it possible to connect another serial device to these pins and still be able to use these ports to communicate to a computer?
As there are 1K series resistors between the SB serial bridge and the input of the arduino, if you connect another device to those pins you can pull the pins to the required level. However when downloading code your other device will either stop the download from happening or the download data will interfere with your other device.
So if you want to use something else on the serial port you better include a switch so you can isolate it during programming.
It has one, soft serial can add more, but they are not real serial ports, and have no buffers or interrupts, and may slow down the execution of your program.
If you have not yet bought your hardware, I recommend you buy a mega, it has 4 real serial ports.
For a year or so they have now
But you are right, it slows down the program - a little bit...
Why only a little bit?
See, most print activities wait in the internal write loop for the last byte to have been shifted out by the hardware. NewSoftSerial does this by code - that makes little difference.
It is possible to improve hardware serial, but no one really does, as it is a little bit awkward.....
Is it possible to connect another serial device to these pins and still be able to use these ports to communicate to a computer?
Yes. The arduino will receive data from both the computer and the attached gizmo on its rx input, and what the arduino sends out on its tx output will go to both the computer and the gizmo. That being said, there can be conflicts between the pc and gizmo on the data being sent and sending at the same time. As to resetting, it has been posted that putting a ~150 ohm resistor betwen the arduino ground pin and the reset pin will prevent a board reset when not desired. This info should be very easy to test to see if it would be of use to you.
The problem comes from the simple implementation of a "blocking" print routine. It does not dump its string to a buffer to become emptied by a "transmit - buffer- empty interrupt", but waits until the last but one character is sent.
This can be changed of course... I added a work around in my co-operative multi-tasking framework... Talking of that, I think I should publish that..