EasyManua.ls Logo

STMicroelectronics STM8 - Page 73

STMicroelectronics STM8
126 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Hardware Connection
Code Example
In this example, Disco board’s user LED is turned-on and off without using any software delay. TIM2 is
used to create time delay as such that the code is not stuck in a time-wasting loop.
#include "STM8S.h"
void clock_setup(void);
void GPIO_setup(void);
void TIM2_setup(void);
void main(void)
{
clock_setup();
GPIO_setup();
TIM2_setup();
while(TRUE)
{
if(TIM2_GetCounter() > 976)

Related product manuals