سلام
من تایمر یک رو راه اندازی کردم و بالا ترین فرکانسی که میتونم روی پایه math داشته باشم 1 مگا هرتز هست!!
چطوری میتونم این فرکانس رو به 5 مگا هرتز برسونم؟؟
ایا تنظیمات خاصی داره؟؟
کد:
TIM_ConfigStruct.PrescaleOption = TIM_PRESCALE_USVAL;
TIM_ConfigStruct.PrescaleValue = 1;
// use channel 0, MR0
TIM_MatchConfigStruct.MatchChannel = 0;
// Enable interrupt when MR0 matches the value in TC register
TIM_MatchConfigStruct.IntOnMatch = TRUE;
//Enable reset on MR0: TIMER will reset if MR0 matches it
TIM_MatchConfigStruct.ResetOnMatch = TRUE;
//Stop on MR0 if MR0 matches it
TIM_MatchConfigStruct.StopOnMatch = FALSE;
//Toggle MR0.0 pin if MR0 matches it
TIM_MatchConfigStruct.ExtMatchOutputType =TIM_EXTMATCH_TOGGLE;
// Set Match value, count value of 10000 (10000 * 100uS = 1000000us = 1s --> 1 Hz)
TIM_MatchConfigStruct.MatchValue = 1; //-->4s
// Set configuration for Tim_config and Tim_MatchConfig
TIM_Init(LPC_TIM1, TIM_TIMER_MODE,&TIM_ConfigStruct);
TIM_ConfigMatch(LPC_TIM1,&TIM_MatchConfigStruct);
/* preemption = 1, sub-priority = 1 */
NVIC_SetPriority(TIMER1_IRQn, ((0x01<<3)|0x02));
/* Enable interrupt for timer 0 */
//NVIC_EnableIRQ(TIMER1_IRQn);
// To start timer 0
TIM_Cmd(LPC_TIM1,ENABLE);