1.
periodic timer interrupt at a rate 4-32x higher than the baudrate.
- + fullduplex, even multichannel could be possible
- + does not require dedicated pin
- + under certain conditions can run from the same timer1 as the HW UART
- - permanently occupies significant % of processor time
http://www.atmel.com/dyn/resources/prod_documents/doc3ab877f2ec329.pdf
http://www.semiconductors.philips.com/acrobat/applicationnotes/AN446.pdf
2.
receiver triggered by an
edge-triggered external interrupt (special: a counter set to roll over on the first edge); then sampled using timer timed at baudrate (first sample at 1/2 baudrate for startbit).
Transmitter simply
using timer at baudrate.
- + low software overhead
- - dedicated (extint) pin needed for Rx
- - fullduplex requires 2 timers
An implementation using PCA found in some 8051 derivatives:
http://www.intel.com/design/mcs51/applnots/270531.htm
3. only receiver or only transmitter by performing the
sampling in a loop in main program
- + simple
- - only 1 direction
- - uses up 100% of processor time
- - virtually excludes using other interrupts simultaneously
An implementation from
Dunfield:
ftp://ftp.dunfield.com/ddsutils.zip