我用ZHX1810与STR912的P1.3、P1.5相连,SD为低。可是当我调用函数SCU_UARTIrDASelect(SCU_UART2,SCU_UARTMode_IrDA);并发送数据,TXD引脚没任何反应,可是注释掉这个函数就有输出的脉冲,但我看了不是调制信号。请教问题可能出在哪?请看以下我的设置对吗? SCU_UARTIrDASelect(SCU_UART2,SCU_UARTMode_IrDA);
GPIO_InitTypeDef GPIO_InitStructure; UART_InitTypeDef UART_InitStructure;
UART_InitStructure.UART_WordLength = UART_WordLength_8D; UART_InitStructure.UART_StopBits = UART_StopBits_1; UART_InitStructure.UART_Parity = UART_Parity_No ; UART_InitStructure.UART_BaudRate = 9600; UART_InitStructure.UART_HardwareFlowControl = UART_HardwareFlowControl_None; UART_InitStructure.UART_Mode = UART_Mode_Tx_Rx; UART_InitStructure.UART_FIFO = UART_FIFO_Enable; UART_InitStructure.UART_TxFIFOLevel = UART_FIFOLevel_1_2; UART_InitStructure.UART_RxFIFOLevel = UART_FIFOLevel_1_2;
SCU_APBPeriphClockConfig(__UART2, ENABLE); SCU_AHBPeriphReset(__UART2,DISABLE);
/*Gonfigure UART2_Tx pin GPIO1.5*/ GPIO_InitStructure.GPIO_Direction = GPIO_PinOutput; GPIO_InitStructure.GPIO_Pin = GPIO_Pin_5; GPIO_InitStructure.GPIO_Type = GPIO_Type_PushPull ; GPIO_InitStructure.GPIO_IPConnected = GPIO_IPConnected_Enable; GPIO_InitStructure.GPIO_Alternate = GPIO_OutputAlt2; GPIO_Init (GPIO1, &GPIO_InitStructure); /*Gonfigure UART2_Rx pin GPIO1.3*/ GPIO_InitStructure.GPIO_Direction = GPIO_PinInput; GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3; GPIO_InitStructure.GPIO_Type = GPIO_Type_PushPull ; GPIO_InitStructure.GPIO_IPConnected = GPIO_IPConnected_Enable; GPIO_InitStructure.GPIO_Alternate = GPIO_InputAlt1; GPIO_Init (GPIO1, &GPIO_InitStructure);
UART_DeInit(UART2); UART_Init(UART2, &UART_InitStructure); UART_Cmd(UART2, ENABLE);
UART_ITConfig(UART2, UART_IT_Transmit | UART_IT_Receive, ENABLE);
VIC_Config(UART2_ITLine, VIC_IRQ, 3); VIC_ITCmd(UART2_ITLine, ENABLE);
UART_IrDACmd(IrDA2, ENABLE); |