cancel
Showing results for 
Search instead for 
Did you mean: 

How to initialise timers

nanuradha
Associate II
Posted on September 14, 2006 at 05:10

How to initialise timers

5 REPLIES 5
kais
Associate II
Posted on May 17, 2011 at 09:32

Hi anuradha,

If I understand you, you mean how to configure timer separately in one mode.If it is, you find below how to configure timer to operate in a desired mode.

/*To configure the TIM3 peripheral as Output Compare Mode on channel 2 :

TIM_InitStruct TIM_InitStructure;

TIM_InitStructure.TIM_Mode = TIM_OCM_CHANNEL_2;

TIM_InitStructure.TIM_Clock_Source = TIM_CLK_APB;

TIM_InitStructure.TIM_Prescaler = 0xFF;

TIM_InitStructure.TIM_OC2_Modes = TIM_WAVE ;

TIM_InitStructure.TIM_Pulse_Level_2 = TIM_HIGH;

TIM_InitStructure.TIM_Pulse_Length_2 = 0xFF00;

TIM_Init (TIM3, &TIM_InitStructure);

/*To configure the TIM2 peripheral as Input Capture Mode on channel1*/

TIM_InitStruct TIM_InitStructure;

TIM_InitStructure.TIM_Mode = TIM_ICAP_CHANNEL_1;

TIM_InitStructure.TIM_Clock_Source = TIM_CLK_APB;

TIM_InitStructure.TIM_Prescaler = 0xFF;

TIM_InitStructure.TIM_ICAP1_Edge = TIM_ICAP1_EDGE_RISING;

TIM_Init (TIM2, &TIM_InitStructure);

/*To configure the TIM0 peripheral in PWM Mode*/

TIM_InitStruct TIM_InitStructure;

TIM_InitStructure.TIM_Mode = TIM_PWM;

TIM_InitStructure.TIM_Clock_Source = TIM_CLK_APB;

TIM_InitStructure.TIM_Prescaler = 0xFF;

TIM_InitStructure.TIM_Pulse_Level_1 = TIM_HIGH;

TIM_InitStructure.TIM_Period_Level = TIM_LOW;

TIM_InitStructure.TIM_Pulse_Length_1 = 0x3FF;

TIM_InitStructure.TIM_Full_Period = 0xFFF;

TIM_Init (TIM0, &TIM_InitStructure);

/*To configure the TIM1 peripheral in PWMI Mode*/

TIM_InitStruct TIM_InitStructure;

TIM_InitStructure.TIM_Mode = TIM_PWMI;

TIM_InitStructure.TIM_Clock_Source = TIM_CLK_APB;

TIM_InitStructure.TIM_Prescaler = 0x7F;

TIM_InitStructure.TIM_ICAP1_Edge = TIM_ICAP1_EDGE_RISING;

TIM_Init (TIM1, &TIM_InitStructure);

/*To configure the TIM2 peripheral in OPM Mode*/

TIM_InitStruct TIM_InitStructure;

TIM_InitStructure.TIM_Mode = TIM_OPM;

TIM_InitStructure.TIM_OPM_INPUT_Edge = TIM_OPM_EDGE_RISING;

TIM_InitStructure.TIM_Clock_Source = TIM_CLK_APB;

TIM_InitStructure.TIM_Prescaler = 0xFF;

TIM_InitStructure.TIM_Pulse_Level_1 = TIM_HIGH;

TIM_InitStructure.TIM_Period_Level = TIM_LOW;

TIM_InitStructure.TIM_Pulse_Length_1 = 0xFFF;

TIM_Init (TIM2, &TIM_InitStructure);

for more details pls refer to ''STR91x Standard Software library user manual'' available in internet.

Regards

Eris.

nanuradha
Associate II
Posted on May 17, 2011 at 09:32

How to initialise timers separately for STR912,there is no details about selection in the reference manual.

kais
Associate II
Posted on May 17, 2011 at 09:32

Hi anuradha,

Yes of course you can store data into secondary Flash while program is running from primary Flash; This can be achieved by FMI software functions. (Pls refer to str91x standard library available in ST web site)

Regards.

Eris

nanuradha
Associate II
Posted on May 17, 2011 at 09:32

Thank you for the reply eris.I have one more doubt.can we store data in secondary flash by using instructions that are executing from primary flash when the application is running.

nanuradha
Associate II
Posted on May 17, 2011 at 09:32

Thank you Eris.Can i select the option of booting from bank1 using keil or is it possible only with CAPS software provided by ST.If that is true is it must to buy the programming cable from ST.