Home > other >  Consult everybody STM32 F103 TIM3 interruption in the LCD display the strange question? A figure
Consult everybody STM32 F103 TIM3 interruption in the LCD display the strange question? A figure

Time:03-29

Inside the interrupt encoder values with LCD_ShowIntNum show that the results appear a strange phenomenon, after each choose encoder display Numbers, the last word will be
A the code , according to incomplete, find their own reason, now found inside the interrupt every time is the last show Numbers out of the question, as shown in the code, the first LCD_ShowIntNum display correctly, how rotary encoder are ok, but the second LCD_ShowIntNum display will appear as shown in figure shows the code , I feel like a LCD display the time is not enough, but in finally added delay delay interrupt function such as finish with LCD display, also not line,
In addition to the first and the second LCD_ShowIntNum before and after the swap, results and final LCD_ShowIntNum shows the code , such LCD_ShowIntNum itself should be no problem

Send a post please expert guidance, do not hire, please do not hesitate to comment, thank you


 void TIM3_IRQHandler (void) 
{
/* the USER CODE BEGIN TIM3_IRQn 0 */


If (LL_TIM_IsActiveFlag_CC1 (TIM3)==SET)
{
UwICValue2=LL_TIM_GetCounter (TIM3)/4;
LL_TIM_OC_SetCompareCH1 (TIM1, uwICValue2);
LCD_ShowIntNum (180100, uwICValue2, sizeof (uwICValue2), WHITE, BLACK, 32).
LCD_ShowIntNum (150, 20, 22, sizeof (22), WHITE, BLACK, 32).//display test
}

LL_TIM_ClearFlag_CC1 (TIM3);
LL_TIM_EnableIT_CC1 (TIM3);


/* the USER CODE END TIM3_IRQn 0 */
/* the USER CODE BEGIN TIM3_IRQn 1 */

/* the USER CODE END TIM3_IRQn 1 */
}


CodePudding user response:

In addition, the LCD is hardware SPI

CodePudding user response:

Take code cannot put the interrupt, you guess is the running time is not enough, also put in the timer interrupt, plus time delay, and it will not interrupt the delays? How to think? Can add delay timer interrupt delay timer interrupt?

CodePudding user response:

But I see the code on the net, also has put the LCD display interruption in operation, this is the need for other special treatment?

CodePudding user response:

You can interrupt long enough, you try set it to 2 seconds, but it is not recommended to do so

CodePudding user response:

Is probably hardware access process safety,
Speculation is the MAIN process and interrupt have access to the LCD, interrupt changed LCD registers, back to the MAIN didn't back to the original value, led the MAIN LCD access to the unknown as a result,

CodePudding user response:

Should be the problem of teacher said 5 floor, I mian there is no code is on TIM2 inside, but I'm TIM3 trigger for (to) turn off the TIM2 or not
This is TIM2 code inside just added LCD_Show TIM3 rotation encoder, display Numbers will be garbled, is no problem, but as long as the LCD_Show commented
 void TIM2_IRQHandler (void) 
{
/* the USER CODE BEGIN TIM2_IRQn 0 */
LL_TIM_DisableIT_CC1 (TIM2);
LCD_ShowString (73, 35, "0.00", CYAN, BLACK, 24, 0).
LL_TIM_ClearFlag_CC1 (TIM2);
LL_TIM_EnableIT_CC1 (TIM2);
/* the USER CODE END TIM2_IRQn 0 */
/* the USER CODE BEGIN TIM2_IRQn 1 */

/* the USER CODE END TIM2_IRQn 1 */
}


I use inside the TIM3:
First off: LL_TIM_DisableIT_CC1 (TIM2);
LL_TIM_DisableCounter (TIM2);
LL_TIM_DisableIT_CC1 (TIM3);

To open: LL_TIM_EnableIT_CC1 (TIM3);
LL_TIM_EnableCounter (TIM2);
LL_TIM_EnableIT_CC1 (TIM2);

This kind of treatment or questions, please help see
?

CodePudding user response:

Speechless, TIM2 and TIM3 have you to write LCD? Certainly can't do this, advise you LCD operations are put in the main, put marks a timer, let the main sign to read operation LCD

CodePudding user response:

Beginners STM32

CodePudding user response:

But still trying to figure out why you can't, I don't want to understand this, I tried a lot of kinds of methods, I directly inside the TIM3 interrupt service function, turn off the TIM2 interrupt TIM3 inside LCD runs out, such as in open TIM3 interruption, by definition write so as not to affect the LCD screen, but why would affect? I tried to put the inside of the TIM2 LCD commented, but none is not TIM2, LCD display also normal??
Still didn't understand the principle, I am only the two interrupt program, and there will be affected?

thank you

CodePudding user response:

There is a problem, two interrupt wrote a LCD, set the priority of the interrupt SCM should not be performed an interrupt the first LCD LCD in another interrupt execution?
Inside the main function is a line and then a line of LCD LCD, why is there a garbled words? Don't understand???????
  • Related