![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
rainbow
Diff: main.cpp
- Revision:
- 247:bfdf0f479a38
- Parent:
- 246:d5742551f432
- Child:
- 248:544011ad9c85
diff -r d5742551f432 -r bfdf0f479a38 main.cpp --- a/main.cpp Fri Jun 17 09:30:42 2022 +0000 +++ b/main.cpp Fri Jun 24 00:18:20 2022 +0000 @@ -214,8 +214,6 @@ ROM_CALL_DATA(); make_delay(); - - // ADC init RCC->APB2ENR |= RCC_APB2ENR_ADC1EN; // clock for ADC3 RCC->APB2ENR |= RCC_APB2ENR_ADC2EN; // clock for ADC2 @@ -241,22 +239,22 @@ // TMR1 init (PWM) Init_TMR1(); - TIM1->CR1 ^= TIM_CR1_UDIS; + TIM1->CR1 &= ~(TIM_CR1_UDIS); make_delay(); // TMR2 init (Control) Init_TMR2(); - TIM2->CR1 ^= TIM_CR1_UDIS; + TIM2->CR1 &= ~(TIM_CR1_UDIS); make_delay(); // TMR3 init (Sensors) Init_TMR3(); - TIM3->CR1 ^= TIM_CR1_UDIS; + TIM3->CR1 &= ~(TIM_CR1_UDIS); make_delay(); // TIM4 init (LVDT) Init_TIM4(); - TIM4->CR1 ^= TIM_CR1_UDIS; + TIM4->CR1 &= ~(TIM_CR1_UDIS); make_delay(); //Timer priority @@ -446,16 +444,9 @@ TIMER INTERRUPT *******************************************************************************/ - -//------------------------------------------------ -// TMR3 : PWM, Sensor 20kHz //------------------------------------------------ -float LVDT_new = 0.0f; -float LVDT_old = 0.0f; -float LVDT_f_cut = 1000.0f; -float LVDT_LPF = 0.0f; -float LVDT_sum = 0.0f; - +// TMR3 : Sensor 20kHz +//------------------------------------------------ float FREQ_TMR3 = (float)FREQ_20k; long CNT_TMR3 = 0; float DT_TMR3 = (float)DT_20k; @@ -534,8 +525,13 @@ //------------------------------------------------ // TMR4 : LVDT 1kHz //------------------------------------------------ -float FREQ_TMR4 = (float)FREQ_20k; -float DT_TMR4 = (float)DT_20k; +float LVDT_new = 0.0f; +float LVDT_old = 0.0f; +float LVDT_f_cut = 1000.0f; +float LVDT_LPF = 0.0f; +float LVDT_sum = 0.0f; +float FREQ_TMR4 = (float)FREQ_1k; +float DT_TMR4 = (float)DT_1k; long CNT_TMR4 = 0; int TMR4_FREQ_10k = (int)FREQ_10k; extern "C" void TIM4_IRQHandler(void)