00001 /*! \file uartsw2conf.h \brief Interrupt-driven Software UART Driver Configuration. */ 00002 //***************************************************************************** 00003 // 00004 // File Name : 'uartsw2conf.h' 00005 // Title : Interrupt-driven Software UART Driver Configuration 00006 // Author : Pascal Stang - Copyright (C) 2002-2003 00007 // Created : 7/20/2002 00008 // Revised : 4/27/2004 00009 // Version : 0.6 00010 // Target MCU : Atmel AVR Series (intended for the ATmega16 and ATmega32) 00011 // Editor Tabs : 4 00012 // 00013 // Description : 00014 // This uart library emulates the operation of a UART (serial port) using 00015 // the AVR's hardware timers, I/O pins, and some software. 00016 // 00017 // Specifically, this code uses: 00018 // -Timer 2 Output Capture for transmit timing 00019 // -Timer 0 Output Capture for receive timing 00020 // -External Interrupt 2 for receive triggering 00021 // 00022 // The above resources cannot be used for other purposes while this software 00023 // UART is enabled. The overflow interrupts from Timer0 and Timer2 can still 00024 // be used for other timing, but the prescalers for these timers must not be 00025 // changed. 00026 // 00027 // Serial output from this UART can be routed to any I/O pin. Serial input 00028 // for this UART must come from the External Interrupt 2 (INT2) I/O pin. 00029 // These options should be configured by editing your local copy of 00030 // "uartsw2conf.h". 00031 // 00032 // This code is distributed under the GNU Public License 00033 // which can be found at http://www.gnu.org/licenses/gpl.txt 00034 // 00035 //***************************************************************************** 00036 00037 #ifndef UARTSW2CONF_H 00038 #define UARTSW2CONF_H 00039 00040 // constants/macros/typdefs 00041 00042 #define UARTSW_RX_BUFFER_SIZE 0x20 ///< UART receive buffer size in bytes 00043 00044 #define UARTSW_INVERT ///< define to invert polarity of RX/TX signals 00045 // when non-inverted, the serial line is appropriate for passing though 00046 // an RS232 driver like the MAX232. When inverted, the serial line can 00047 // directly drive/receive RS232 signals to/from a DB9 connector. Be sure 00048 // to use a current-limiting resistor and perhaps a diode-clamp circuit when 00049 // connecting incoming RS232 signals to a microprocessor I/O pin. 00050 00051 // if non-inverted, the serial line idles high (logic 1) between bytes 00052 // if inverted, the serial line idles low (logic 0) between bytes 00053 00054 00055 // UART transmit pin defines 00056 #define UARTSW_TX_PORT PORTB ///< UART Transmit Port 00057 #define UARTSW_TX_DDR DDRB ///< UART Transmit DDR 00058 #define UARTSW_TX_PIN PB3 ///< UART Transmit Pin 00059 00060 // UART receive pin defines 00061 // This pin must correspond to the 00062 // External Interrupt 2 (INT2) pin for your processor 00063 #define UARTSW_RX_PORT PORTB ///< UART Receive Port 00064 #define UARTSW_RX_DDR DDRB ///< UART Receive DDR 00065 #define UARTSW_RX_PORTIN PINB ///< UART Receive Port Input 00066 #define UARTSW_RX_PIN PB2 ///< UART Receive Pin 00067 00068 #endif