Page 48 - 완) I MDP 프로젝트 작품 보고서(전체과 1학년)1.6
P. 48
}
④ RCC.c
#include <stm32f10x.h>
void RCC_Configuration()
{
SystemInit();
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA |
RCC_APB2Periph_USART1, ENABLE);
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_DMA1,
ENABLE);
//RCC_APB1PeriphClockCmd();
}
⑤ USART.c
#include <stm32f10x.h>
#include <stdio.h>
#include <stm32f10x_usart.h>
#include <string.h>
void USART1_SendByte(u16 data)
{
while (!(USART1->SR & USART_FLAG_TXE));
USART1->DR = (data & (uint16_t)0x01ff);
}
void USART1_write(u8 *data)
{
u16 i;
for (i=0; i<strlen(data); i++)
{
USART1_SendByte(data[i]);
}
}
- 41 -