home  general  lard  emul8or  ArdweeNET  MAXX  the QUUB  Gecko  SiiMAN
        embedded systems  PC software

Some AVR processors don't have a hardware UART and it's necessary to "bit bang" the serial data out a normal IO pin.

This routine does just this on an ATtiny85 using timer interrupts to send the bits, meanwhile the main() loop is free to do other stuff. However it should be noted that, at the internal resonator speed, there's not much time left for other work if you are continually transmitting. See tip 01 and tip 02 for more about this.

Note that this code doesn't start/stop the timer as you would normally do if transmitting was an infrequent event, it simply sets a state variable that is read next time the timer interrupts.

Get the code file serial_bit_bang_85_tx.txt

 


Copyright © 1973-2013 Rob Gray, All rights reserved.
PO Box 450, Gin Gin, QLD, Australia.
www.robgray.com