Question
STM32l152 USART configuration
Posted on December 19, 2012 at 12:47
Hello pals i am new to the stm32 programming, i am trying to configure usart via irq handler, can someone help?
#include <stm32l1xx.h>
#include ''stm32l1xx_usart.h''
#include ''STM32_Init.h''
void
SendByte (
int
byte
);
int
main (
void
)
{
stm32_Init();
return
0;
}
void
USART1_IRQHandler (
void
)
{
volatile unsigned
int
vsr;
int
ByteSent;
vsr= USART1->SR;
if
(vsr& USART_FLAG_RXNE)
// did we interrupt on the read
{
// clear the interrupt since we are processing it
USART1->SR &= ~(USART_FLAG_RXNE);
ByteSent = (USART1->DR & 0x1FF);
SendByte(ByteSent);
}
}
void
SendByte (
int
byte
)
{
//Wait for the uart to finish sending the byte.
while
(!(USART1->SR & USART_FLAG_TXE));
USART1->DR = (
byte
& 0xFF);
}
STM32_Init.c(32): error: #5: cannot open source input file ''STM32_Reg.h'': No such file or directory
#uar