中级会员
 
- 积分
- 369
- 金钱
- 369
- 注册时间
- 2013-12-23
- 在线时间
- 32 小时
|
使用串口在超级终端上输出一些东西,前些天用得好好的,今天加了些模块后串口无法输出了,请教各位会是什么原因?
这是串口的程序:
#include "usart.h"
#ifdef __GNUC__
#define PUTCHAR_PROTOTYPE int __io_putchar(int ch)
#else
#define PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f)
#endif
void USART_RCC_Configuration(void)
{
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA|RCC_APB2Periph_USART1,ENABLE);
}
void USART_GPIO_Configuration(void)
{
GPIO_InitTypeDef GPIO_InitStruct;
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_AF_PP;
GPIO_InitStruct.GPIO_Pin = GPIO_Pin_9;
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_IN_FLOATING;
GPIO_InitStruct.GPIO_Pin = GPIO_Pin_10;
GPIO_Init(GPIOA, &GPIO_InitStruct);
}
void USART_Configuration(void)
{
USART_InitTypeDef USART_InitStruct;
USART_RCC_Configuration();
USART_InitStruct.USART_BaudRate = 115200;
USART_InitStruct.USART_StopBits = USART_StopBits_1;
USART_InitStruct.USART_WordLength = USART_WordLength_8b;
USART_InitStruct.USART_Parity = USART_Parity_No;
USART_InitStruct.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
USART_InitStruct.USART_Mode = USART_Mode_Tx | USART_Mode_Rx; //使能接收和发送
USART_Init(USART1, &USART_InitStruct);
USART_Cmd(USART1, ENABLE);//使能串口1
USART_GPIO_Configuration();
}
#if 1
#pragma import(__use_no_semihosting)
struct __FILE
{
int handle;
};
FILE __stdout;
_sys_exit(int x)
{
x = x;
}
#endi
原来在工程中添加了DMA和ADC使用的DMA1的通道1,ADC1的通道110和11双通道,使用起来都没有问题,今天又加了DMA2的通道三和DAC的通道一和二双通道,但是现在串口不能用了 |
|