amintlk
Member level 1
- Joined
- Aug 23, 2010
- Messages
- 36
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,286
- Location
- bojnourd
- Activity points
- 1,523
i use mikroC Pro For ARM ..i drive rotary encoder with timer1 and it work well , but when i want to use prescaler by TIM1_PSC register it doesn't effect on my TIM1_CNT register and my output change base on prescaler=0;
there are rotary encoder config code :
RCC_APB2ENR.TIM1EN = 1;
TIM1_CCMR1_Input.B1=0;
TIM1_CCMR1_Input.B0=1;
TIM1_CCMR1_Input.B9=0;
TIM1_CCMR1_Input.B8=1;
TIM1_CCER.CC1P=0 ;
TIM1_CCER.CC2P=0 ;
TIM1_SMCR.B2=0 ;
TIM1_SMCR.B1=1;
TIM1_SMCR.B0=1;
TIM1_PSC = 39 ; // when i change this register it doesn't effect on output
TIM1_CR1.CEN = 1;
TIM1_ARR =60000; //'MAX COUNT
do{
WordToStr(TIM1_CNT, text);
UART2_Write_Text(text);
delay_ms(20);
}while(1);
there are rotary encoder config code :
RCC_APB2ENR.TIM1EN = 1;
TIM1_CCMR1_Input.B1=0;
TIM1_CCMR1_Input.B0=1;
TIM1_CCMR1_Input.B9=0;
TIM1_CCMR1_Input.B8=1;
TIM1_CCER.CC1P=0 ;
TIM1_CCER.CC2P=0 ;
TIM1_SMCR.B2=0 ;
TIM1_SMCR.B1=1;
TIM1_SMCR.B0=1;
TIM1_PSC = 39 ; // when i change this register it doesn't effect on output
TIM1_CR1.CEN = 1;
TIM1_ARR =60000; //'MAX COUNT
do{
WordToStr(TIM1_CNT, text);
UART2_Write_Text(text);
delay_ms(20);
}while(1);