Skip to main content
jgalea
Associate III
February 10, 2009
Question

USART Set up

  • February 10, 2009
  • 2 replies
  • 534 views
Posted on February 10, 2009 at 19:20

USART Set up

    This topic has been closed for replies.

    2 replies

    jgalea
    jgaleaAuthor
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 13:02

    Hello. Im trying to transmit a number using the USART system. Please, do I need to add more initialisation code to the one I used. Many Thanks Johann. Im including the code used so far.

    RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1 | RCC_APB2Periph_TIM1 |

    RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB |

    RCC_APB2Periph_GPIOC | RCC_APB2Periph_USART1, ENABLE);

    void USART_Set_up(void)

    {

    USART_InitTypeDef USART_InitStructure; //declaration of structure

    USART_DeInit(USART1); //places USART1 to default reset value

    /* Enable the USART1 */

    USART_Cmd(USART1, ENABLE);

    USART_InitStructure.USART_BaudRate = 9600;

    USART_InitStructure.USART_WordLength = USART_WordLength_8b;

    USART_InitStructure.USART_StopBits = USART_StopBits_1;

    USART_InitStructure.USART_Parity = USART_Parity_No;

    USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;

    USART_InitStructure.USART_Mode = USART_Mode_Tx;

    USART_Init(USART1, &USART_InitStructure);

    }

    USART_SendData(USART1, 0x26); //38 decimal

    kaouther
    Associate II
    May 17, 2011
    Posted on May 17, 2011 at 13:02

    Refer to any USART example in the

    http://www.st.com/mcu/modules.php?name=mcu&file=familiesdocs&FAM=110#Firmware

    .