EasyManuals Logo

STMicroelectronics STM8 User Manual

STMicroelectronics STM8
126 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #120 background imageLoading...
Page #120 background image
Creating new libraries is simple. Just need to follow the following steps:
There should be a header file and a source file for every new module. For example, lcd.h and
lcd.c.
Every header file should start with the inclusion of stm8s.h header file (#include "stm8s.h"). This
header is needed because it allows the access to the internal hardware modules available in
a STM8 micro. For example, we will need access to GPIOs to develop our LCD library.
A good practice is that the header files only contain function prototypes, definitions,
constants, enumerations and global variables.
The corresponding source file must only include its header file in beginning.
The source file should contain the body of codes for all functions declared in the header file.
When one library is dependent on the functions of another’s, the one that will be required in
the new library must be included first. For example, we will need delay library in coding the
LCD library because there are delay_ms functions in some parts of the library and so delay
library should be included first. This should be the systematic order:
#include “stm8s_delay.h
#include “lcd.h”
You can include these files at the bottom part of the stm8s_conf.h header file complying with
right precedence as shown below:
Alternatively, you can add them after the first line #include “stm8s.h” in your main source
code.

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the STMicroelectronics STM8 and is the answer not in the manual?

STMicroelectronics STM8 Specifications

General IconGeneral
BrandSTMicroelectronics
ModelSTM8
CategoryMicrocontrollers
LanguageEnglish

Related product manuals