ECU/GSM/dist/src/Timer_prog.c
void Timer1_Genetare_PWM(void)
{

	RCC_vidEnablePeripheral(RCC_u8TIM1CLK);
	TIM1_CR1 &= ~(DIR);
	TIM1_CR1 |= ARPE;

	TIM1_PSC = PSCVALUE;

	/* SET THE PERIOD OF THE PWM*/
	TIM1_ARR = ARRVALUE;

	/* SET THE VALUE OF THE DUTY CYCLE THE PWM*/
	TIM1_CCR1 = CCR1VALUE;

	/* SET PWM MODE (CHOOSE PWM MODE 1)*/
	TIM1_CCMR1 |= OC1M;

	/*ENABLE OUTPUT COMPARE1 PRELOAD */
	TIM1_CCMR1 |= OC1PE;

	/* INITIALIAZE ALL THE REGISTERS */
	TIM1_EGR |= UG;

	/* ENABLE COMPARE1 OUTPUT*/
	TIM1_CCER |= CC1E;

	/* MAIN OUTPUT ENABLE*/
	TIM1_BDTR |= MOE;

	/* CONFIGURE CHANNEL 1 OUTPUT */
	TIM1_CCMR1 &= ~(CHANNEL1OUTPUT);

	TIM1_CR1 |= CEN;
}
/****************************************************************************/
/* Description 	: Generating PWM signal by using timer 1					*/
/* input 		:void														*/
/*output		:void														*/
/*scope			:															*/
/****************************************************************************/
Description    : Generating PWM signal by using timer 1
input          :void
output          :void
scope                   .
Description : Generating PWM signal by using timer 1 input : void output : void scope .
void Timer1_Genetare_PWM(void)
{
	RCC_vidEnablePeripheral(RCC_u8TIM1CLK);
	TIM1_CR1 &= ~(DIR);
	TIM1_CR1 |= ARPE;
	TIM1_PSC = PSCVALUE;
	TIM1_ARR = ARRVALUE;
	TIM1_CCR1 = CCR1VALUE;
	TIM1_CCMR1 |= OC1M;
	TIM1_CCMR1 |= OC1PE;
	TIM1_EGR |= UG;
	TIM1_CCER |= CC1E;
	TIM1_BDTR |= MOE;
	TIM1_CCMR1 &= ~(CHANNEL1OUTPUT);
	TIM1_CR1 |= CEN;
}
void Timer1_Genetare_PWM ( void ) { RCC_vidEnablePeripheral ( RCC_u8TIM1CLK ) ; TIM1_CR1 &= ~ ( DIR ) ; TIM1_CR1 |= ARPE ; TIM1_PSC = PSCVALUE ; TIM1_ARR = ARRVALUE ; TIM1_CCR1 = CCR1VALUE ; TIM1_CCMR1 |= OC1M ; TIM1_CCMR1 |= OC1PE ; TIM1_EGR |= UG ; TIM1_CCER |= CC1E ; TIM1_BDTR |= MOE ; TIM1_CCMR1 &= ~ ( CHANNEL1OUTPUT ) ; TIM1_CR1 |= CEN ; }
Description    : Generating PWM signal by using timer 1
input          :void
output          :void
scope                   :
Description : Generating PWM signal by using timer 1 input : void output : void scope :
/* SET THE PERIOD OF THE PWM*/ /* SET THE VALUE OF THE DUTY CYCLE THE PWM*/ /* SET PWM MODE (CHOOSE PWM MODE 1)*/ /*ENABLE OUTPUT COMPARE1 PRELOAD */ /* INITIALIAZE ALL THE REGISTERS */ /* ENABLE COMPARE1 OUTPUT*/ /* MAIN OUTPUT ENABLE*/ /* CONFIGURE CHANNEL 1 OUTPUT */