At 08:49 AM 11/18/2004, Jose Fuentes wrote: >I want to use a Attiny11 (price under 0.54) and >implement a serial port. Since it doesn't have a >USART I have to write the software to allow the >microcontroller to send and receive data. If somebody >has done something like this in assembly or C please >let me know. Attiny11 only has 1KB FLASH and 32 >general purpose registers. >Thanks. You may be a bit hosed here. The T11's RC osc isn't calibrated, so you'd have to use a resonator or xtal at the cost of two pins. If that works for you, then set up an int at the baud rate. Receive: Put RXD on the hardware int pin (PB1) When you see the start bit, set the timer to int you in half a bit time. When that int fires, sample the data. If still low, you have a valid start bit, and the next 8 timer ints simply sample and shift. If you want, you can pay attention to the stop bit, one more int, should be "idle". Transmit: TXD on any pin. Set the int to fire at the baud rate. Send a start bit, 8 data, and one stop.. It's not that awful, but that means you have only two more pins available on the chip, and one of them is reset.. 8 pin chip, VCC, Gnd, X1, X2, TXD, RXD, Reset.. One pin left. Don't spend it all in one place!
Message
Re: [AVR-Chat] SERIAL PORT IN ATTINY
2004-11-18 by Dave VanHorn
Attachments
- No local attachments were found for this message.