LCD on STM8S Discovery

Was bored so decided to finally use this STM8S dev board. It works well. I just have to read up on it more to determine actual speed of MCU…

Here is my Code and Pictures… CODE

About atomsoft

Starting a small company. Trying to build it from ground up. Only 2 employees so far. Nothing serious yet but soon!

17 responses to “LCD on STM8S Discovery”

  1. M. Uhlmann says :

    i´m an old boy (54)from germany. I have ordered the STM8s Kit. Your lib is cool. I will try this with a 20*4 Display.
    regards Michael

  2. M. Uhlmann says :

    I got the Kit yesterday and today the display is working! Thanks for your work!

  3. KlaasDC says :


    Thanks for your library! You saved me a couple of hours 🙂

  4. Nakim says :

    Hello Guys,
    Does anyone tryed the STM8L-Discovery(LCD on the board) ? This is the Ultra low power version of this kit.

    Thanks a lot.

  5. George says :

    Thank you for your code.
    I want to know just what is the
    component US2 between GND and VDD.
    best regards

  6. will says :

    this code that you posted works when compiling? i am getting 3 errors.. also how does this code work without using #include stm8s_gpio.h? i am using raisonance btw.
    *** ERROR C104 IN LINE 50 OF main.c : Invalid parameter declaration for ‘LCD_DATA’

    *** ERROR C077 IN LINE 52 OF main.c : Invalid expression syntax

    *** ERROR C077 IN LINE 53 OF main.c : Invalid expression syntax

    • atomsoft says :

      I havent played with this in a LONG LONG time. If it works for everyone and not you it has to be something your doing… not to sound like a jerk tho. Um.. maybe you can goto the forums i goto and ask for some help 🙂

      • Nick says :

        I’ve been working on converting your code over for the STM8L. There aren’t too many differences but I did want to poke back here to post a solution to this problem. I know that its a bit late for Will, but this may be able to help someone else. Also worth mentioning, I am compiling using raisonance.

        With the error: Invalid parameter declaration for ‘LCD_DATA’
        The variable names that are being used cause some issues with the raisonance compiler. Simply change the names of variables ‘data’ and ‘type’. So I did a “Find and Replace” to change ‘data’ to varData’ and ‘type’ to ‘varType’.

        Also to anyone else converting to STM8L:
        Remember that some defines are not all caps, so for example ‘GPIO_PIN_ALL’ would be ‘GPIO_Pin_All’
        You will also need to replace all occurrences of:
        because these are not defined in the STM8L firmware provided. I got around this by defining at the top of main:
        #define GPIO_HIGH(a,b) a->ODR|=b
        #define GPIO_LOW(a,b) a->ODR&=~b
        I then changed all of the ‘GPIO_WriteLow’ and ‘GPIO_WriteHigh’ occurrences accordingly.

        I am further mutilating the code to work in 8-bit mode, when I’m finished I will post back here with a link. Thanks for sharing your code for this project Atomsoft. This has been a fantastic starting point for me to learn from!

      • Nick says :

        After some thought I realize that the 8-bit version of this may not be great for everyone, as 4-bit mode is rather popular.

        If you like, Atomsoft, you could email me and I will send you a txt of the version for a 4-bit STM8L interface for your visitors. Its the least I can do seeing that you have already done most of the work for us. I would post it in the comments section here but it seems like that would just be a big unformatted mess. Hopefully WordPress allows you to see my email address, if not post back and we can work something out.

  7. will says :

    hmm.. well were you using the raisonance toolchain? and was main.c and stm8s.h the ONLY two files used in your project? i am probably just forgetting something dumb.. i am pretty new to this

  8. George says :

    I want to make a program that is triggered if there ‘s an event on PIN_7 (GPIOB)
    I made a wired connection between PIN_7 (GPIOB) and PIN_3 (GPIOB) to test

    I tried with this code but it does not work

    #include “stm8s.h”

    int main(void)



    GPIO_WriteLow(GPIOB, GPIO_PIN_3);
    // i wille connect GPIOB, GPIO_PIN_3 with GPIO_PIN_7 to test

    if ((GPIO_ReadInputData(GPIOB) & GPIO_PIN_7)== (u8)0x00)

    GPIO_WriteHigh(GPIOD, GPIO_PIN_0);

    u16 d;
    for (d = 0; d < 10000; ++d)
    GPIO_WriteReverse(GPIOD, GPIO_PIN_0);
    can you give me a solution


  9. Marou_Mac says :

    Please atomsoft can you help me to programming LCD 2×16 on STM32VL Discovery ??
    Please !!!

Leave a Reply to Nakim Cancel reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: