반응형
Notice
Recent Posts
Recent Comments
Link
Brise
STM32F401RE-nucleo CMSIS UART 예제 본문
반응형
12345678910111213141516171819202122232425 #include "stm32f4xx.h"int main(){RCC->AHB1ENR |= RCC_AHB1Periph_GPIOA;GPIOA->MODER &= ~((0x3 << 6) | ( 0x3 << 4));GPIOA->MODER |= ((0x2 << 6) | ( 0x2 << 4));GPIOA->AFR[0] &= ~( (0x0F << 12) | (0x0F << 8));GPIOA->AFR[0] |= ( (0x7 << 12) | (0x7 << 8));RCC->APB1ENR |= RCC_APB1Periph_USART2;USART2->CR1 |= USART_Mode_Rx | USART_Mode_Tx;USART2->BRR = 0x00000683; // 16Mhz 클럭 사용시 9600bpsUSART2->CR1 |= (1<< 13);while(1) {if((USART2->SR & (1<<5)) != 0) {int data = USART2->DR;while((USART2->SR & (1 << 7)) == 0){}USART2->DR = data;}}}cs
반응형
'MCU' 카테고리의 다른 글
STM32F411RE-nucleo UART 데이터 중계 예제 (0) | 2017.12.05 |
---|---|
STM32F411RE-nucleo Printf 예제 (0) | 2017.12.05 |
STM32F411RE-nucleo Standard Peripheral UART 예제 (0) | 2017.12.05 |
STM32F429-DISC1 디스커버리 보드 BSP와 CubeMX 연동하여 사용하기 (0) | 2017.11.11 |
[STM32CubeMX] STM32F429-DISC0 엔코더값 입력받기(quadrature encoder pulse) -2 (0) | 2017.04.29 |
[STM32CubeMX] STM32F429-disc0 엔코더값 입력받기(quadrature encoder pulse) -1 (0) | 2017.04.28 |
[STM32CubeMX] STM32F429-DISC0 LCD 출력하기 (0) | 2017.04.27 |
Comments