Hallo, ich wollte den Mikrocontroller so einstellen, dass der Button mein Taktgeber ist und habe es mit folgendem Code versucht: GPIOA->MODER |= GPIO_MODER_MODER0_1; // Enable AF mode for A0 GPIOA->AFRL = (GPIOA->AFRL & 0xFFFFFFF0) | 0b0010; // Select AF2 for A0 (TIM3/4/5) RCC->APB1ENR |= RCC_APB1ENR_TIM5EN; // Enable TIM5 clock TIM5->CCMR1 |= TIM_CCMR1_CC1S_0; // Input mode, map TI1 to IC1 TIM5->CCER &= ~(TIM_CCER_CC1P | TIM_CCER_CC1NP); // CC1P and CC1NP = 0 for rising edge //TIM5->SMCR |= TIM_SMCR_SMS; // External clock mode 1 TIM5->SMCR |= TIM_SMCR_ECE; TIM5->SMCR |= TIM5->SMCR; // Trigger selection: TI1 TIM5->PSC = 0; TIM5->ARR = 2; TIM5->DIER |= TIM_DIER_UIE; TIM5->CR1 |= TIM_CR1_CEN; // Enable TIM5 counter Leider funktioniert es nicht richtig bzw. verstehe ich nicht ganz wie es arbeitet. Habt ihr eine Idee? Liebe Grüße
Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.