00001 /*! \file uartswconf.h \brief Interrupt-driven Software UART Driver Configuration. */ 00002 //***************************************************************************** 00003 // 00004 // File Name : 'uartswconf.h' 00005 // Title : Interrupt-driven Software UART Driver Configuration 00006 // Author : Pascal Stang - Copyright (C) 2002-2004 00007 // Created : 7/20/2002 00008 // Revised : 4/27/2004 00009 // Version : 0.1 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 1 Output Compare A for transmit timing 00019 // -Timer 1 Output Compare B for receive timing 00020 // -Timer 1 Input Capture for receive triggering 00021 // 00022 // The above resources cannot be used for other purposes while this software 00023 // UART is enabled. The overflow interrupt from Timer1 can still be used for 00024 // other timing, but the prescaler for Timer1 must not be changed. 00025 // 00026 // Serial output from this UART can be routed to any I/O pin. Serial input 00027 // for this UART must come from the Timer1 Input Capture (IC1) I/O pin. 00028 // These options should be configured by editing your local copy of 00029 // "uartswconf.h". 00030 // 00031 // This code is distributed under the GNU Public License 00032 // which can be found at http://www.gnu.org/licenses/gpl.txt 00033 // 00034 //***************************************************************************** 00035 00036 #ifndef UARTSWCONF_H 00037 #define UARTSWCONF_H 00038 00039 // constants/macros/typdefs 00040 00041 #define UARTSW_RX_BUFFER_SIZE 0x20 ///< UART receive buffer size in bytes 00042 00043 #define UARTSW_INVERT ///< define to invert polarity of RX/TX signals 00044 // when non-inverted, the serial line is appropriate for passing though 00045 // an RS232 driver like the MAX232. When inverted, the serial line can 00046 // directly drive/receive RS232 signals to/from a DB9 connector. Be sure 00047 // to use a current-limiting resistor and perhaps a diode-clamp circuit when 00048 // connecting incoming RS232 signals to a microprocessor I/O pin. 00049 00050 // if non-inverted, the serial line idles high (logic 1) between bytes 00051 // if inverted, the serial line idles low (logic 0) between bytes 00052 00053 00054 // UART transmit pin defines 00055 #define UARTSW_TX_PORT PORTD ///< UART Transmit Port 00056 #define UARTSW_TX_DDR DDRD ///< UART Transmit DDR 00057 #define UARTSW_TX_PIN PD5 ///< UART Transmit Pin 00058 00059 // UART receive pin defines 00060 // This pin must correspond to the 00061 // Timer1 Input Capture (ICP or IC1) pin for your processor 00062 #define UARTSW_RX_PORT PORTD ///< UART Receive Port 00063 #define UARTSW_RX_DDR DDRD ///< UART Receive DDR 00064 #define UARTSW_RX_PORTIN PIND ///< UART Receive Port Input 00065 #define UARTSW_RX_PIN PD6 ///< UART Receive Pin 00066 00067 #endif