1 2.4 2.399 260.4375 -0.04% 2.3999 1041.6875 0.04%
2 9.6 9.596 65.125 -0.04% 9.599 260.4375 -0.01%
3 19.2 19.193 32.5625 -0.03% 19.203 130.1875 -0.02%
4 57.6 57.471 10.875 -0.22% 57.637 43.375 0.06%
5 115.2 114.942 5.4375 -0.22% 115.274 21.6875 0.06%
6 230.4 232.558 2.6875 -0.94% 229.885 10.875 -0.22%
7 460.8 454.545 1.375 -1.36% 459.77 5.4375 -0.22%
8 921.6 不可能 不可能 不可能 930.232 2.6875 0.94%
补充一问题
USART_InitTypeDef USART_InitStructure;
u8 TxBuffer[] = "ASFGGSGSFGDSFDS";
u8 RxBuffer[TxBufferSize];
u8 TxCounter = 0, RxCounter = 0;
TestStatus TransferStatus = FAILED;
ErrorStatus HSEStartUpStatus;
/* Private function prototypes -----------------------------------------------*/
void RCC_Configuration(void);
void GPIO_Configuration(void);
void NVIC_Configuration(void);
TestStatus Buffercmp(u8* pBuffer1, u8* pBuffer2, u16 BufferLength);
u8 index = 0;
void SysTick_Config(void);
void LcdShow_Init(void);
/* Private functions ---------------------------------------------------------*/
/*******************************************************************************
* Function Name : main
* Description : Main program
* Input : None
* Output : None
* Return : None
*******************************************************************************/
int main(void)
{
#ifdef DEBUG
debug();
#endif
/* System Clocks Configuration */
RCC_Configuration();
/* NVIC configuration */
NVIC_Configuration();
/* Configure the GPIO ports */
GPIO_Configuration();
/* Configure the systick */
SysTick_Config();
LcdShow_Init();
/* USART1 and USART2 configuration ------------------------------------------------------*/
/* USART and USART2 configured as follow:
- BaudRate = 230400 baud
- Word Length = 8 Bits
- One Stop Bit
- Even parity
- Hardware flow control disabled (RTS and CTS signals)
- Receive and transmit enabled
- USART Clock disabled
- USART CPOL: Clock is active low
- USART CPHA: Data is captured on the second edge
- USART LastBit: The clock pulse of the last data bit is not output to
the SCLK pin
*/
USART_InitStructure.USART_BaudRate =9600;
USART_InitStructure.USART_WordLength = USART_WordLength_8b;
USART_InitStructure.USART_StopBits = USART_StopBits_1;
USART_InitStructure.USART_Parity = USART_Parity_Even;
USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
USART_InitStructure.USART_Clock = USART_Clock_Disable;
USART_InitStructure.USART_CPOL = USART_CPOL_Low;
USART_InitStructure.USART_CPHA = USART_CPHA_2Edge;
USART_InitStructure.USART_LastBit = USART_LastBit_Disable;
/* Configure USART1 */
USART_Init(USART1, &USART_InitStructure);
/* Configure USART2 */
USART_Init(USART2, &USART_InitStructure);
/* Enable the USART1 */
USART_Cmd(USART1, ENABLE);
/* Enable the USART2 */
USART_Cmd(USART2, ENABLE);
while(TxCounter < TxBufferSize)
{
/* Send one byte from USART1 to USART2 */
USART_SendData(USART1, TxBuffer[TxCounter++]);
/* Loop until the end of transmit */
while(USART_GetFlagStatus(USART1, USART_FLAG_TC) == RESET)
{
}
/* Loop until the USART2 Receive Data Register is not empty */
while(USART_GetFlagStatus(USART2, USART_FLAG_RXNE) == RESET)
{
}
/* Store the received byte in RxBuffer */
RxBuffer[RxCounter++] = (USART_ReceiveData(USART2) &0x7F );
}
以上程序是从串口1发送数据ASFGGSGSFGDSFDS到串口2,接受到的数据为什么要与上0x7F(RxBuffer[RxCounter++] = (USART_ReceiveData(USART2)&0x7F );)与上0xFF就有几个数据出错