• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

stm8s timer

Status
Not open for further replies.
Hello. I am new to st microcontroller. I have performed a few basic projects and used stvd for debugging. But for quite a few days, I have stuck to a problem.

While coding for a timer related program, I am facing an error : symbol _TIM1_DeInit not defined. Googling didn't help me much. I have included all the necessary files but the problem still persists. Do I have to edit something in any of the files like stm8s_tim1.h?
Kindly help me.
Thank you.
 
You need to write the Definition of this function on your own in the c file i suppose something like this

Void Tim1_deinit(void)
{
}
 

Ian Rogers

User Extraordinaire
Forum Supporter
Most Helpful Member
Ok Thanks.
But do you have idea about how to set timing value in the code. Also, I am receiving 'missing protoype' error in stm8s_tim1.c file.
It seems you have a header file to include... Remember C is case sensitive... Within your IDE there will be a "find definition" selection...

Where did you get your code?... If it was in ans example folder, then other files within that folder need to be included.. ie.. all the .h files..
 
missing protoype is generally a warning. But if it error you can remove that error using the following example

void Tim1_deinit(void); // Prototype for the function.

int main(void)
{
// your code here
}

void Tim1_deinit(void)
{
// your code here
}
 
What you are saying may be absolutely right, but the error appears in the included stm8s_tim1.c file which is available in the library files from st microelectronics and not in my code. In fact, there are number of 'missing prototype' errors. That is why, I feel, that something has to be changed in stm8s_tim1.c file.
Thank you.
 
If you can share your project then probably it will very easy to resolve the issue. If i am interpreting correctly you are including the .c file which is wrong you can only include .h files.
 
Last edited:

Ian Rogers

User Extraordinaire
Forum Supporter
Most Helpful Member
Ok.. The reason for all the errors is pretty straight forward..

stm8s_tim1.c is in your include list... Two things... A) its before the definitions as stm8s_tim1.h comes next!!

And B) C files do not live in the include world... As long as they are listed in your build the parts you use will be included.. So remove this line...

#include "stm8s_tim1.c"
 
Another thing is that when I compile the main.c file after removing #include "stm8s_tim1.c" line, it doesn't show any error as it did before removing that line. Now, only when I build, the errors appear.
 

Ian Rogers

User Extraordinaire
Forum Supporter
Most Helpful Member
It appears that tim1.c is st standard file. If you have not edited this file then the header file should be in the installation directory. You have to search for this file. In the tim1.c file you can change the header file as <tim1. h> instead of "tim1. h".
 
It appears that tim1.c is st standard file. If you have not edited this file then the header file should be in the installation directory. You have to search for this file. In the tim1.c file you can change the header file as <tim1. h> instead of "tim1. h".
I have included both tim1.c and tim1.h files properly. Also, tim1.c file doesn't accept any change. Thanks.
 
Status
Not open for further replies.

Latest threads

EE World Online Articles

Loading
Top