2013-11-03 10:57 AM
Hi all!
this is my first post I apologize for the banality of the subject, but they are just starting out with programming the micro.I wanted to ask if it is possible to utilize two timers, where the first increase of one unit the second just complete the period.is possible to obtain an example in code?thanks to all #stm32 #timer #discovery2013-11-03 01:11 PM
Master-Slave mode?
2013-11-03 10:05 PM
may better explain the difference between the two modes?
2013-11-04 06:13 AM
I'd start with the Reference Manual, and then work through the timer examples. STM32F4xx_DSP_StdPeriph_Lib_V1.2.0\Project\STM32F4xx_StdPeriph_Examples\TIM\TIM_ExtTriggerSynchro
2013-11-11 08:23 AM
I found a possible solution. I created a timer that generates a PWM channel CH1 of tim2. Now I could use a timer that takes as input the PWM how could I do?
2013-11-11 08:24 AM
I found a possible solution. I created a timer that generates a PWM channel CH1 of tim2. Now I could use a timer that takes as input the PWM how could I do?
2013-12-17 11:05 PM
Hello, I m new in micro-controller programming world, so i have a problem regarding timer, plz help..
I wish to count no. of pulses in 1 sec, for that i have to create a loop of 1 sec , But I am unable to prescale counter,some more commands might be needed, here is the code RCC_APB1ENR |= TIM3EN; TIM3_PSC = 10000; TIM3_ARR =4200; TIM3_CR1 |=0x01; // CNTR ENABLE while((TIM3_SR & 0x01) != 0x01) // condn for countr overflow flag set { count1++; }TIM3_SR &= ~(0x01); while((TIM3_SR & 0x01) != 0x01) // condn for countr overflow flag set and loop of 1sec { count3++; } this is for timer and prescaller only bt the overall code is #include ''defines.h'' int volatile count1 , count2 , count3, count4 , count5 ,count6 ;int main(){ count1 = 0; count2 = 0; count3 = 0; count4 = 0; count5 = 0; count6 = 0; //-------------clock----------------------------------- RCC_APB1ENR |= TIM3EN; // TIM CLOCK, TIMR ENABLE RCC_AHB1ENR |= (GPIOBEN | GPIOAEN ); // GPIO//-------------GPIO CONFIG---------------------------------- GPIOA_MODE |= (MODER_AF_PIN6 ); // MODER PIN A6= TIM3 CH1 GPIOA_OSPEED |= (SPEEDR_100MHZ_6); //SPEED 100MHZ GPIOA_PUPDR |= (PUPDR_UP_PIN6); // PUPD IS UP GPIOA_AFRL |= 0x02000000 ; // PA6 CONNECTED TO AF TIM3 CH1 TIM3_CCMR1 |= 0x01; // CC1S= 01, channel is configured as input, IC1 is mapped on TI1.TIM3_CCMR1 |= 0x30; // IC1F= 0011 FILTER BY 8 CYCLESTIM3_CCER |=0x00 ; // CC1P=CC1NP= 00 ACTIVE EDGE SELECTIONTIM3_PSC = 10000;TIM3_CR1 |=0x00; // CNTR IN UPCOUNTING MODE, DIR =UPCOUNTINGTIM3_CCER |=0x01 ; // Enable capture from the counter into the capture registerTIM3_ARR =4200; //----------------capture counter value----------------TIM3_CR1 |=0x01; // CNTR ENABLE while((TIM3_SR & 0x01) != 0x01) // condn for countr overflow flag set { count1++; }TIM3_SR &= ~(0x01); while((TIM3_SR & 0x01) != 0x01) // condn for countr overflow flag set { count2++; if( (TIM3_SR & 0x02) == 0x02) { count3++; count4 = TIM3_CCR1; if( (TIM3_SR & 0x0100) ==0x0100 ) { count3++; count4 = TIM3_CCR1; } } } }here the aim is, count3 will give the no. of pulses in 1 sec...but i am also not sure that the main clock is 42 mhz...if possible then plz suggest me how to configure main clock too...and 1 more thing, its giving exact no. of pulses in 1 sec when ARR is set to 1600 in above program .So, it means the clock should be 16 Mhz,..is it so? and how? suggestions plz...