USART1 and dynamic graph
Hi, I want to receive 20 bytes.
I want to receive them every 2 milliseconds and simultaneously.
To show data, I am working with TOUCHGFX. I use dynamic graphs to show them.
The problem is, I want to show 12 bits on each graph.
I debugged my code , it seams I don't loose data.
but my graph is not fed correctly.
I have 2 signs in my data packets, first is 240 and last is 180.
here is the code:
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart){
if(Sign[0]==240){
HAL_UART_Receive(&huart1,(uint8_t*)RxBuf,19,100);
FlagFinsh=1;
HAL_UART_Receive_IT(&huart1,(uint8_t*)Sign,1);
}else {
HAL_UART_Receive_IT(&huart1,(uint8_t*)Sign,1);
HAL_GPIO_TogglePin(RED_GPIO_Port, RED_Pin);
}
}
and in my touchgfx screen in handletickevent function , I just extern and add data to graph:
void Screen2View::handleTickEvent()
{
tickCounter++;
if(FlagFinsh==1){
FlagFinsh=0;
if(++i > 120) i=0;
Data= (((RxBuf[3] >> 4)*256)+RxBuf[1])- 1700;
dynamicGraph1.addDataPoint(Data);
}
Thanks.
