Skip to main content
NMelo.1
Associate II
January 24, 2023
Question

Hi, I would like to print to the screen a string, reported below in Details, with the celsius degree symbol "°". However, I find other characters if I look to the screen. Is it possible to change alphabet with some option of the STM32CubeID to find "

  • January 24, 2023
  • 3 replies
  • 3325 views

0693W00000Y91K6QAJ.jpg0693W00000Y91JcQAJ.jpg

    This topic has been closed for replies.

    3 replies

    Peter BENSCH
    Technical Moderator
    January 24, 2023

    Welcome, @Nicolò Meloncelli​, to the community!

    This has nothing to do directly with the STM32CubeIDE, but with the character set that your display supports. You would have to look at its datasheet and find out if it has the DEGC character in its character set. If it does, you would have to send its hex code as a character, but that would only apply to that particular display.

    Does it answer your question?

    Regards

    /Peter

    In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
    NMelo.1
    NMelo.1Author
    Associate II
    January 24, 2023

    Hi Peter,

    with the following code variation I've the symbol "°" in the display. I don't know why I can't write == '°' and leave "°C" instead of =='?' and " ?C". If I do so the if condition is skipped. 0693W00000Y92NGQAZ.jpg0693W00000Y92N6QAJ.jpg0693W00000Y92N1QAJ.jpg

    Peter BENSCH
    Technical Moderator
    January 24, 2023

    Well, you have not yet inserted the character set of your two-line LCD here. As a rule, the character set only partially matches that in operating systems such as Windows, Linux or MacOS, mostly only in the ASCII range 0x20 (space)...0x7D (left curly bracket).

    However, on many of these LCDs, the question mark is usually coded with 0x3F and the degree sign with 0xDF.

    You should now check:

    • how the character set of the LCD is defined,
    • which byte your compiler generates at the position of the question mark and,
    • if necessary, replace the question mark, which is not recognisable as a degree sign in the source code, with the corresponding hexadecimal code.

    I would also check how the display routine converts the bytes to be sent to the LCD from the input string.

    By the way: please be so kind and do not post source code snippets as screenshots, but for better readability and testability with the code snippet button </> below the text box.

    Regards

    /Peter

    In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
    S.Ma
    Principal
    January 24, 2023

    In my case for a 16x2 char LCD display:

    Spec and character table is here

    Code example is here

    Snapshot:

    0693W00000Y93fuQAB.png