Eu sei, eu sei...porque eu não uso o truestudio...eu estou começando a brincar com ele e entender...mas por enquanto estou atado ao mikroc...
Obrigado

Moderadores: andre_luis, 51
void InterruptRx() // A cada interrupção o registro Receive acolhe o dado:
iv IVT_INT_USART1 ics ICS_AUTO //RX interrupt subroutine
{
if(USART1_SRbits.RXNE == 1) //RX buffer not empty
{
Receive = (0xFF & USART1_DR); //Read data from data register
}
}
void ConfigSetup() // Referencia no manual stm f103
{
RCC_APB2ENRbits.IOPAEN = 1; //Enable GPIOA
RCC_APB2ENRbits.USART1EN = 1; //Enable USART1
GPIOA_CRH = 0x4A0; //Set PA9 and PA10 as AFIO pins
USART1_BRR = 0x341; //Set value for required baud rate
USART1_CR1bits.UE = 1; //Set USART1
USART1_CR1bits.RE = 1; //Set USART1 RX to receive incoming data
USART1_CR1bits.TE = 1; //Set USART1 TX to send data
USART1_CR1bits.RXNEIE = 1; //Enable RX interrupt
NVIC_IntEnable(IVT_INT_USART1);
}
Voltar para STMicroelectronics
Usuários navegando neste fórum: Google [Bot] e 1 visitante