我在SimpleBLEPeripheral工程里面添加USART 1初始化函数,但是添加上以后程序会跑飞,我检查串口初始化函数没有找到错,我用的是1.6和1.7管脚,但是1.4和1.5管脚用的是USART 0的SPI模式,这对程序有影响吗?谁在SimpleBLEPeripheral工程里面添加过初始化函数,能不能给个初始化例程做个参考
下面再贴上我的串口初始化程序,大家帮忙看看
void GPS_ConfigUART(void)
{
/* UART/SPI Peripheral configuration */
uint8 baud_exponent;
uint8 baud_mantissa;
CLKCONCMD&=~(1<<6);
while(CLKCONCMD&(1<<6));
CLKCONCMD&=~((1<<6)|(7<<0));
/* Set SPI on UART 0 alternative 2 */
PERCFG |= 0x02;
P1SEL|=0xc0;
P2SEL|=0x40;//优先级设置
baud_exponent = 8;
baud_mantissa = 59;
/* Configure SPI */
U1UCR = 0x80; /* Flush and goto IDLE state. 8-N-1. */
U1UCR = 0x02;
U1CSR |= 0xc0; /* UARTmode, */
U1GCR = baud_exponent;
U1BAUD = baud_mantissa;
URX1IE=1;
EA=1;
URX1IF=0;
}