2009-02-10 10:20 AM
USART Set up
2011-05-17 04:02 AM
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 decimal2011-05-17 04:02 AM
Refer to any USART example in the
http://www.st.com/mcu/modules.php?name=mcu&file=familiesdocs&FAM=110#Firmware
.