Docs

Micro-controllers, wireless transmission and database

Head

LED Blink STM8S103F3P6 using ST Visual develop IDE

Wiring Diagram

Diagram

Downloads

COSMIC STM8 Compiler

ST Visual develop IDE

STM8S/A Standard peripheral library

C Language manual (Optional)

main.c code

#include "stm8s.h"

main()
{
    // setup()
    GPIO_Init(GPIOB, GPIO_PIN_5, GPIO_MODE_OUT_PP_LOW_SLOW);
    // loop()
    while (1)
    {
        unsigned long i; // variable used by delay
        GPIO_WriteHigh(GPIOB, GPIO_PIN_5);
        for(i=0; i<10000; i++); // some delay
        GPIO_WriteLow(GPIOB, GPIO_PIN_5);
        for(i=0; i<10000; i++); // some delay
    }
}

stm8s_conf.h code

#ifndef __STM8S_CONF_H
#define __STM8S_CONF_H

/* Includes ------------------------------------------------------------------*/
#include "stm8s.h"


#include "stm8s_gpio.h"

/* Exported macro ------------------------------------------------------------*/
#ifdef  USE_FULL_ASSERT

/**
  * @brief  The assert_param macro is used for function's parameters check.
  * @param expr: If expr is false, it calls assert_failed function
  *   which reports the name of the source file and the source
  *   line number of the call that failed.
  *   If expr is true, it returns no value.
  * @retval : None
  */
#define assert_param(expr) ((expr) ? (void)0 : assert_failed((uint8_t *)__FILE__, __LINE__))
/* Exported functions ------------------------------------------------------- */
void assert_failed(uint8_t* file, uint32_t line);
#else
#define assert_param(expr) ((void)0)
#endif /* USE_FULL_ASSERT */

#endif /* __STM8S_CONF_H */