Greetings!
Here's another Serial replacement, that's entirely interrupt-driven, and can work with any arbitrary pair of pins:
http://telobot.com/downloads/nbserial20.zip.
Just add it to your libraries, and you'll find a simple example in there.
For a simple test, jumper two pins, set those as the Rx and Tx pins in the example (pins 2 and 3 by default), and run the NBSerialDemo.
NBSerial uses interrupts for every bit that is sent or received, so if you have some "interrupt hog" that's keeping interrupts disabled for long intervals, it's not going to work. For example, NBSerial could not run with NewSoftSerial, because the latter disables interrupts for a long time.
To use it, check the "txavailable" function before sending characters, and the "available" function before receiving them, and the routines will never block. That means that your loop can continue taking care of business without being distracted with serial duties.
Coming Soon: Non-Blocking Wire 1.0!
My motivation is a project that uses Serial, Wire, and SPI, all of which block while they're sending and receiving. I figured I'd be forever dropping information there, while I was receiving or transmitting it here. I have the Wire stuff conned, and would like to do the same for SPI - actually the LinkSprite Diamondback Wifi Arduino, but I really haven't looked at it, yet.
Send comments, questions, problems here, or to Gene@Telobot.com
Thumbs Up!
Gene Knight