cancel
Showing results for 
Search instead for 
Did you mean: 

STM8S103F2 TIMER EXAMPLE(needed please)

keskintaylan
Associate II
Posted on November 24, 2009 at 06:49

STM8S103F2 TIMER EXAMPLE(needed please)

11 REPLIES 11
keskintaylan
Associate II
Posted on May 17, 2011 at 15:05

I did it, yeah i did it! :-]

The problem is weird...:

I disassemble the code. I check this '' TIM2->IER = 1; '' and i see in disassembler '' MOV 0x5301,#0x01 '' but TIM2 interrupt register address is 0x5303. Then i check STM8S.h -> I found there :

typedef struct TIM2_struct

{

vu8 CR1;

#if defined STM8S103

vu8 RESERVED1;

vu8 RESERVED2;

#endif

vu8 IER;

vu8 SR1;

.

.

.

.

}

Then i realize that the compiler don't see reserved bits.Thus IER's address was 5301. So i remove defines and tataaa... program worked.

But still i don't understand why compiler passover reserved bits? Why ''#if defined STM8S103'' didn't work?

Thank you anyway mozra...

[ This message was edited by: keskintaylan on 21-11-2009 13:19 ]

mozra27
Associate II
Posted on May 17, 2011 at 15:05

Hi,

Sorry for the late answer,

The FWLib is common for all STM8S family and by default the STM8S208 product is selected.

The user can configure the target STM8S device used in his application in the stm8s, in your case you should make this configuration without updating any peripheral struct.

#if !defined (STM8S208) && !defined (STM8S207) && !defined (STM8S105) && !defined (STM8S103) && !defined (STM8S903)

/* #define STM8S208 */

/* #define STM8S207 */

/* #define STM8S105 */

#define STM8S103

/* #define STM8S903 */

#endif

Regards

mozra