00001 /*H************************************************************************** 00002 * $RCSfile: uart_bdr.h,v $ 00003 *---------------------------------------------------------------------------- 00004 * Copyright (c) 2003 Atmel. 00005 *---------------------------------------------------------------------------- 00006 * RELEASE: $Name: mc100_bldc_sensorless_0_1_0 $ 00007 * REVISION: $Revision: 1.5.2.3 $ 00008 * FILE_CVSID: $Id: uart_bdr.h,v 1.5.2.3 2006/05/05 16:56:14 rletendu Exp $ 00009 *---------------------------------------------------------------------------- 00010 * PURPOSE: 00011 * Provide Baudrate configuration for MCU 00012 *****************************************************************************/ 00013 #ifndef _UART_BDR_H 00014 #define _UART_BDR_H 00015 00016 #ifndef AVRGCC 00017 #define Uart_set_baudrate(bdr) ( UBRRH = (Uchar)((((Uint32)FOSC*1000L)/((Uint32)bdr*16)-1)>>8),\ 00018 UBRRL = (Uchar)(((Uint32)FOSC*1000 )/((Uint32)bdr*16)-1) ) 00019 #else 00020 #define Uart_set_baudrate(bdr) ( UBRR = (U16)(((U32)FOSC*1000L)/((U32)bdr*16)-1)) 00021 #endif 00022 00023 #define Uart_double_bdr() (UCSRA |= (1<<U2X1)) 00024 00025 #endif/* _UART_BDR_H */ 00026
1.4.7