Home > Back-end >  An array of
An array of

Time:03-22

In a recent study GM65 qr code identification module, some difficulties in the process, would like to ask the bosses of BBS,
First of all, the qr code identification module is a serial port communication, here I use the USART3, via a serial port interrupt to receive data, code and the serial port to accept data is as follows:
 
The static uint8_t ch;


Void USART3_Init (void)
{
GPIO_InitTypeDef GPIO_InitStruct.
USART_InitTypeDef USART_InitStruct;
NVIC_InitTypeDef NVIC_InitStruct.

RCC_APB2PeriphClockCmd (RCC_APB2Periph_GPIOB | RCC_APB2Periph_AFIO, ENABLE);
RCC_APB1PeriphClockCmd (RCC_APB1Periph_USART3, ENABLE);

//USART_DeInit (USART3);

//PB10 - & gt; TX
GPIO_InitStruct. GPIO_Pin=GPIO_Pin_10;
GPIO_InitStruct. GPIO_Mode=GPIO_Mode_AF_PP;
GPIO_InitStruct. GPIO_Speed=GPIO_Speed_50MHz;
GPIO_Init (GPIOB, & amp; GPIO_InitStruct);

//PB11 - & gt; RX
GPIO_InitStruct. GPIO_Pin=GPIO_Pin_11;
GPIO_InitStruct. GPIO_Mode=GPIO_Mode_IN_FLOATING;
GPIO_Init (GPIOB, & amp; GPIO_InitStruct);

USART_InitStruct. USART_BaudRate=9600;
USART_InitStruct. USART_Parity=USART_Parity_No;
USART_InitStruct. USART_StopBits=USART_StopBits_1;
USART_InitStruct. USART_WordLength=USART_WordLength_8b;
USART_InitStruct. USART_Mode=USART_Mode_Tx | USART_Mode_Rx;
USART_InitStruct. USART_HardwareFlowControl=USART_HardwareFlowControl_None;
USART_Init (USART3, & amp; USART_InitStruct);

USART_Cmd (USART3, ENABLE);
USART_ClearFlag (USART3, USART_FLAG_TC);
USART_ITConfig(USART3, USART_IT_RXNE, ENABLE);//can make a serial port receiving interrupt


NVIC_InitStruct. NVIC_IRQChannel=USART3_IRQn;
NVIC_InitStruct. NVIC_IRQChannelPreemptionPriority=0;
NVIC_InitStruct. NVIC_IRQChannelSubPriority=1;
NVIC_InitStruct. NVIC_IRQChannelCmd=ENABLE;
NVIC_Init (& amp; NVIC_InitStruct);


}

Void USART3_IRQHandler (void)
{

While (USART_GetFlagStatus (USART3, USART_FLAG_RXNE)==SET)
{
USART_ClearITPendingBit (USART3, USART_IT_RXNE);
Ch=USART_ReceiveData (USART3);

Printf (" ch=% c \ r \ n ", ch);


}
USART_ClearFlag (USART3, USART_FLAG_TC);//to solve the loss of the first character
}

Read data for ch=123 + 321 (this is the content of the qr code)

My problem now is that how to put this data in an array, such as the num []=,2,3,3,2,1 {1}; Or num []={1, 2, 3, + 3, 2, 1};
Try some solution not here, there is no other ideas, so I ask,
Bosses, please help to give directions, thank you very much, thank you sincerely,
  • Related