سلام.
یه برنامه تایمر نوشتم.
اما نمیدونم چرا وقفه سرریز تایمر کار نمیکنه.
کد:
#include "stm32f10x.h"
void TIM1_UP_IRQHandler (void) {
if ((TIM1->SR & 0x0001) != 0) { // check interrupt source
TIM1->SR &= ~(1<<0); // clear UIF flag
}
}
int main(void) {
RCC->APB2ENR=RCC_APB2ENR_IOPBEN | RCC_APB2ENR_IOPAEN | RCC_APB2ENR_IOPCEN | RCC_APB2ENR_TIM1EN ; // GPIOA,b,c Enable Clock
TIM1->CR2=0X100;
TIM1->PSC=50000;
TIM1->ARR=0x7ff;
TIM1->CR1= TIM_CR1_CEN;
TIM1->DIER= TIM_DIER_COMIE | TIM_DIER_TIE | TIM_DIER_UIE | TIM_DIER_CC1IE | TIM_DIER_BIE; //enable interrupt
//--------------------------------------------------------------------------------------------------------------------
GPIOB->CRL=1;
GPIOB->ODR=0; ////////////////--------=============================
while(1){
}
}