Page 188 - 3-1
P. 188
USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
USART_InitStructure.USART_Mode = USART_Mode_Rx |
USART_Mode_Tx;
USART_Init(USART2, &USART_InitStructure);
USART_ITConfig(USART2, USART_IT_RXNE, ENABLE);
USART_Cmd(USART2, ENABLE);
/* DIR485_L; */
}
void USART2_IRQHandler(void)
{
u8 c;
if(USART_GetITStatus(USART2, USART_IT_RXNE) != RESET)
{
c=USART2->DR;
USART2_SendByte(c);
}
}
#include "stm32f10x.h"
volatile unsigned char c='s';
volatile unsigned int pwmval = 700;
volatile unsigned int CCR1_Val = 500;
void GPIO_Configuration()
{
GPIO_InitTypeDef GPIO_InitStructure;
//TIM2_PWM 핀 설정
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOA, &GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
- 188 -