cancel
Showing results for 
Search instead for 
Did you mean: 

USART Set up

jgalea
Associate II
Posted on February 10, 2009 at 19:20

USART Set up

2 REPLIES 2
jgalea
Associate II
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
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

.