57. STM32CubeIDE LCD 1602 Display. I2C 16x2 with STM32F103C8T6

Поделиться
HTML-код
  • Опубликовано: 14 окт 2024
  • STM32 Blue Pill for beginners
    Code and diagram are at www.micropeta....

Комментарии • 54

  • @NizarMohideen
    @NizarMohideen  2 года назад +4

    If itoa function gives you an error, use sprintf instead of itoa as shown below
    sprintf(snum,"%d", x);
    You need to include stdio.h for this function as shown below
    /* USER CODE BEGIN Includes */
    #include "stdio.h"
    /* USER CODE END Includes */

  • @eduardodelarosaferrer2205
    @eduardodelarosaferrer2205 3 года назад +1

    I'veseen many videos and tutorials about 1602 Display, but this is , by far, the best of them.

    • @NizarMohideen
      @NizarMohideen  3 года назад +1

      Thank you. Thanks to the library creator JIHOON LEE (eziya)

  • @shrijithmjain2137
    @shrijithmjain2137 3 года назад +2

    Hello sir I have never missed any of your video, your content is amazing I have tried almost all projects, I would recommend you to do a bluepill project where MCU would send a live time data to http server or firebase using GSM(GPRS).

    • @NizarMohideen
      @NizarMohideen  3 года назад

      Great suggestion!

    • @shrijithmjain2137
      @shrijithmjain2137 3 года назад

      @@NizarMohideen I need your mail ID so that I could contact you, I'm doing a project in the http protocol please let me know how do i contact you sir.

    • @NizarMohideen
      @NizarMohideen  3 года назад +1

      nizarmohideen@hotmail.com

  • @bigcatdairy
    @bigcatdairy Год назад +4

    I did it in the exact same way but nothing displayed lol, what could be wrong pl?

    • @AbuBokorSiddik-
      @AbuBokorSiddik- 11 месяцев назад

      How did you solve your problem?can you help me

    • @bigcatdairy
      @bigcatdairy 11 месяцев назад

      @@AbuBokorSiddik-i don't remember exactly, i remember just setup incubemx then told chatgpt to write the code then it worded

  • @oangiabao5481
    @oangiabao5481 Месяц назад

    hi, i don't know how to use HD44780_CreateSpecialChar, HD44780_PrintSpecialChar, HD44780_LoadCustomCharacter. Can you show me a example to use it ? Please

  • @BechirZalila
    @BechirZalila 2 года назад +1

    Thank you. Excellent tutorials.

  • @sahilmanihar9894
    @sahilmanihar9894 3 года назад +3

    Can you make a video on interfacing dht11 temperature and humidity sensor using STM32 and it's output showing on lcd 🙏🙏

    • @NizarMohideen
      @NizarMohideen  3 года назад +1

      Hi Sahil,
      It is very simple.
      Follow this video for LCD Displayand video ruclips.net/video/BK-bL9cMOSM/видео.html for DHT11.
      For I2C speed ***DO NOT CHANGE*** Fast Mode (LCD works Standard mode 100000Hz)
      I have prepared the code for DHT11 with LCD1602 below
      /* USER CODE BEGIN Includes */
      #include "liquidcrystal_i2c.h"
      #include "stdio.h"
      /* USER CODE END Includes */
      /* USER CODE BEGIN 0 */
      #define DHT11_PORT GPIOB
      #define DHT11_PIN GPIO_PIN_9
      uint8_t RHI, RHD, TCI, TCD, SUM;
      uint32_t pMillis, cMillis;
      float tCelsius = 0;
      float tFahrenheit = 0;
      float RH = 0;
      uint8_t TFI = 0;
      uint8_t TFD = 0;
      char strCopy[15];
      void microDelay (uint16_t delay)
      {
      __HAL_TIM_SET_COUNTER(&htim1, 0);
      while (__HAL_TIM_GET_COUNTER(&htim1) < delay);
      }
      uint8_t DHT11_Start (void)
      {
      uint8_t Response = 0;
      GPIO_InitTypeDef GPIO_InitStructPrivate = {0};
      GPIO_InitStructPrivate.Pin = DHT11_PIN;
      GPIO_InitStructPrivate.Mode = GPIO_MODE_OUTPUT_PP;
      GPIO_InitStructPrivate.Speed = GPIO_SPEED_FREQ_LOW;
      GPIO_InitStructPrivate.Pull = GPIO_NOPULL;
      HAL_GPIO_Init(DHT11_PORT, &GPIO_InitStructPrivate); // set the pin as output
      HAL_GPIO_WritePin (DHT11_PORT, DHT11_PIN, 0); // pull the pin low
      HAL_Delay(20); // wait for 20ms
      HAL_GPIO_WritePin (DHT11_PORT, DHT11_PIN, 1); // pull the pin high
      microDelay (30); // wait for 30us
      GPIO_InitStructPrivate.Mode = GPIO_MODE_INPUT;
      GPIO_InitStructPrivate.Pull = GPIO_PULLUP;
      HAL_GPIO_Init(DHT11_PORT, &GPIO_InitStructPrivate); // set the pin as input
      microDelay (40);
      if (!(HAL_GPIO_ReadPin (DHT11_PORT, DHT11_PIN)))
      {
      microDelay (80);
      if ((HAL_GPIO_ReadPin (DHT11_PORT, DHT11_PIN))) Response = 1;
      }
      pMillis = HAL_GetTick();
      cMillis = HAL_GetTick();
      while ((HAL_GPIO_ReadPin (DHT11_PORT, DHT11_PIN)) && pMillis + 2 > cMillis)
      {
      cMillis = HAL_GetTick();
      }
      return Response;
      }
      uint8_t DHT11_Read (void)
      {
      uint8_t a,b;
      for (a=0;a cMillis)
      { // wait for the pin to go high
      cMillis = HAL_GetTick();
      }
      microDelay (40); // wait for 40 us
      if (!(HAL_GPIO_ReadPin (DHT11_PORT, DHT11_PIN))) // if the pin is low
      b&= ~(1

    • @sahilmanihar9894
      @sahilmanihar9894 3 года назад

      @@NizarMohideen hello sir any library have to include for this project

    • @NizarMohideen
      @NizarMohideen  3 года назад +1

      Inside Core/Inc Folder
      github.com/eziya/STM32_HAL_I2C_HD44780/blob/master/Src/liquidcrystal_i2c.h
      Inside Core/Src Folder
      github.com/eziya/STM32_HAL_I2C_HD44780/blob/master/Src/liquidcrystal_i2c.c

    • @s7-theunknown834
      @s7-theunknown834 10 месяцев назад

      Error shows up in line no 73,74,165 on main.c saying that htim1 undeclared
      What should i do now? 🙏🏻

  • @alinavaid9291
    @alinavaid9291 10 месяцев назад

    Hello. I am trying to connect an Geeek Pi LCD to NUCLEO-L053R8 using IC2 interface. I was wondering if the I2C address for this LCD will be the same as the LCD used in the example. I would really appreciate if we can connect, i am working on my senior design project.

  • @yasserlamari3619
    @yasserlamari3619 5 месяцев назад

    i am using stm32f030f4p6 and I got problem in liquid_crystal_i2c.c in the syntaxe DWT..... (I changed the source to 0xx...instead of 4xx which means the problem is not here) so what is the problem

  • @asifahmad4199
    @asifahmad4199 Год назад +1

    Thanks for your guide line. Please guide me how can I modified code for 20x4 lcd

  • @mertali7605
    @mertali7605 2 месяца назад

    I tried it on arduino and it works, but when I try it the way you show, the first 8 digits are fine but the last 8 digits are rectangular. Is there any solution for this?

    • @mertali7605
      @mertali7605 2 месяца назад

      solved it, my voltage regulator was broken and I was feeding the lcd with 12 volts

  • @hacker6695
    @hacker6695 Год назад

    i hope we can drag and drop the .C and .H Files to SRC and Include folder respectively ?

  • @fatiswealth7865
    @fatiswealth7865 2 года назад

    Hi, other than the Ground and Vcc, the other 2 pins does it matter which pin it is connected to? Must it be a ADC pin or just normal GPIO pins will do? :)

    • @NizarMohideen
      @NizarMohideen  2 года назад +1

      We need to use I2C pins only.
      If you use I2C1 (SCL - pin PB6 and SDA - pin PB7)
      If you use I2C2 (SCL - pin PB10 and SDA - pin PB11)

  • @kaxagvimraze6536
    @kaxagvimraze6536 Год назад +1

    I have a problem that LCD is not displaying. first line of display is on and that's it , do someone had same problem?

  • @aissatoudieng8151
    @aissatoudieng8151 2 года назад

    Hello, I am doing a project on STM32 with ADLX345 and LCD display in I2C. can you please help me

  • @arrazyzaid
    @arrazyzaid Месяц назад

    Why does it still give an error even though I've followed it from start to finish?

  • @Zurenio
    @Zurenio 10 месяцев назад

    Great...

  • @roopesh668
    @roopesh668 2 года назад

    Sir I am using Keil and CubeMX. For me, the folder structure doesn't have Include folder. What to do?

    • @aliakbar4068
      @aliakbar4068 Год назад

      Open the C file and C header file in any notepad or wordpad , and in keil uv , in the application folder create the .c and .h file and name them accordingly and paste the content in it , it will resolve your issue

  • @alifioahmad_raihan
    @alifioahmad_raihan 2 года назад

    Sir, I have tried to follow step by step but when compile find an error : make: *** [Core/Src/subdir.mk:37: Core/Src/liquidcrystal_i2c.o] Error 1
    How to fix it sir ?

    • @NizarMohideen
      @NizarMohideen  2 года назад +1

      Put liquidcrystal_i2c.h file inside Core/Inc folder
      Put liquidcrystal_i2c.c file inside Core/Src folder

  • @METHEE.C
    @METHEE.C Год назад

    Can print float data type?.

  • @truca100
    @truca100 7 месяцев назад

    hello, i have nothing on the lcd, i have only the light switch on and switch off!!!

    • @truca100
      @truca100 7 месяцев назад +1

      finally i found my problem, the potentiometer on the driver 8574 was incorrectly adjusted from the factory. Now it works very well, thx :) Can i ask you to make a same vdo with a optocoupler sensor IR RPM, thx in advance ;)

    • @NizarMohideen
      @NizarMohideen  7 месяцев назад

      Thanks

    • @NizarMohideen
      @NizarMohideen  7 месяцев назад +1

      I made a video on STM32CubeIDE Optocoupler sensor module as RPM meter (Tachometer) with STM32F103C8T6. Link is below
      ruclips.net/video/4MUIaXnK8yw/видео.html

  • @vinodkinoni4863
    @vinodkinoni4863 3 года назад

    Very nice sir g

    • @vinodkinoni4863
      @vinodkinoni4863 3 года назад

      Plz send the the display module configuration

    • @NizarMohideen
      @NizarMohideen  3 года назад

      Thanks

    • @NizarMohideen
      @NizarMohideen  3 года назад

      What "display module configuration" you need. Please let me know

  • @flightandsimulationcenter5175
    @flightandsimulationcenter5175 2 года назад

    error: #253: expected a "," , why?

  • @H25639SRV
    @H25639SRV 5 месяцев назад

    ../Core/Inc/liquidcrystal_i2c.h(61): warning: #1295-D: Deprecated declaration HD44780_Clear - give arg types
    i have this error i don't know what to do :( but your video are very useful thank you so much sir

    • @NizarMohideen
      @NizarMohideen  5 месяцев назад

      if you change void HD44780_Clear(); in the library to void HD44780_Clear(void);
      The compiler may not throw this error
      Add (void) inside the brackets and see

    • @H25639SRV
      @H25639SRV 5 месяцев назад

      @@NizarMohideen thank you so much sir i will try it 🥰

    • @H25639SRV
      @H25639SRV 5 месяцев назад

      @@NizarMohideen it worked! thank you sir and it only have the error ..\Core\Src\liquidcrystal_i2c.c(32): error: #253: expected a ","
      thank you so much for helping me sir

  • @renukadyawarkonda393
    @renukadyawarkonda393 2 года назад

    its not working

    • @NizarMohideen
      @NizarMohideen  2 года назад

      Make sure the LED jumper in back module is not missing