This tutorial shows you how to use the LCD1602 with STM32 boards using HAL libraries. Here is a link for the LCD library files (.h & .c files): drive.google.com/open?id=1d1N...
hi, i'm using stm32f103c8t6 in HAL library. I generate the initialization with stm32cubemx and import your lcd library to my project. it built successfully without any error. when i upload the program it showed nothing, do you have any idea what could've been wrong? thanks before
Your video is very helpful sir. Can you upload a video on interfacing mysql database with stm32f4 so that we will get an idea on how to interface with databases. Thankyou in advance.
Is there a reason you changed the clock from 16 to 168 MHzMine has a bunch of circles on the screen then when i press the black button on my Nucleo stm32 f466re. It turns into a bunch of strange characters / symbols on the screen.
i am using Nucleo-l053r8 , i have changed the #include from the driver file linked on this video from stm32f0xxx to stm32l0xx , got rid of the error but the lcd does not work, can you help ?
Hi, thank you for the good video and explanation! Unfortunately I did all the same as you,but my lcd won't print anything. I use the same discovery board and lcd as you. Any suggestions would be appreciated, thank you in advance :)
hello , I have done the same thing which is showed in the video and the connections , but I am not getting the data on lcd. i used 8bit operation and my board is 'STM32F401C DISCO'.
Hello Sir I want to know that whether we can delay in STM32f407vg less than 1millisec i-e of 1microsec or of 1 nanosec using HAL_Delay not by for loop. As we know HAL_Delay(1) means 1millisec. But Sir I have to produce a delay with extreme accuracy of 1nanosec. I am using HAL_Delay for accuracy purposes. Sir if there is any other method, then kindly share your thoughts. I'll be very grateful for this.
Hi, can i use this library for any other STM32 microcontroler series ? for example STM32F3 series. I changed #include "stm32f3xx_hall.h" but did not work. Any suggestion ?
for some reason it works if i use the same pin shown at the video, but when i try change the pin (still gpio output) it display nothing. also sometime it display words that i cant understand (random character). please any explanation?
Thanks a lot bro. Just a question : I want to use the same library for a 20x4 LCD module (2004A). To do so, I had the idea of modifying the function "LCD1602_setCursor" in the file "STM_MY_LCD_16x2.c", but I didn't know what values the variable "maskData" should have in the if/else conditions. Any Idea ? Thanks in advance.
Hi Youcef, According to some LCD 20x4 from Github, the Set cursor offsets should be as follows: #define LCD_OFFSET_LINE0 0x0 #define LCD_OFFSET_LINE1 0x40 #define LCD_OFFSET_LINE2 0x14 #define LCD_OFFSET_LINE3 0x54 void lcd_move_cursor(const uint8_t line, const uint8_t position) { uint8_t command = LCD_SET_DDADR + position; switch(line) { case 0: command += LCD_OFFSET_LINE0; break; case 1: command += LCD_OFFSET_LINE1; break; case 2: command += LCD_OFFSET_LINE2; break; case 3: command += LCD_OFFSET_LINE3; break; default: // Wrong line return; } I will consider expanding this library to include larger LCD sizes. Good luck
hi I am using stm32cubeide, when I added this two I am getting an error on "#include " file Print.h: No such file or directory can you please help to resolve it
Hello Mohamed, your video is very helpful, thanks for share your know-how. Would I to know how to write more than one character in the same line using your library for LCD 16x2? I'm waiting your answer, thanks.
It should work on the all stm32 boards. It's not up of the stm32 microcontroler but it's up to the type of LCD controller. But i think with other controller like HD44780 should it also work.
ty man this is very nice but i have changed the pins and this hasnt worked well what is going on? and; if somebody encounter that "error: L6236E: No section matches selector - no section to be FIRST/LAST." just close program and run again it will work
hello sir, I have done the same thing which is showed in the video and the connections are Vss-> GND, Vdd-> 5v, V0-> 10K potentiometer , RS->PE0, RW-> GND, E-> PE1, D0-D3 -> no connection, D4-D7 -> PD8-PD11, A->5v, k->GND. But I am not getting the data on lcd.
It didn't work on F051R8 discovery. Just a screen and brightness works, they directly belongs voltage. I tried only 4 bits way, i check everything, couldn't find a solution
MohamedYaqoobSTM, i like your chanel!!! Can you make a video about OLED displays (128x64 with I2C). Are you working on hardware too, or just on software?
Camila Obando It shows: Programming Done. Verify OK. But nothing is shown on my LCD after programming, everything is connected as supposed, what could be wrong? HELP, please!
muchas gracias! muito obrigado!! Thanks!! working in my blue pill! stm32f103c8, must to be careful in change in the STM_MY_LCD16X2.h file the line #include "stm32f4xx_hal.h" to #include "stm32f1xx_hal.h"
Hello Sir I am using Proteus for simulation and STM32F103R6 IC. I have connected everything but not getting any output on LCD. Is it any problem with timer or what. Thanks in advance.
That was to follow datasheet guidelines strictly of Microsecond delay. But you're right in some sense that we can do a Microsecond delay with a different much easier way. I will update this driver shortly to fix this
It shows: Programming Done. Verify OK. But nothing is shown on my LCD after programming, everything is connected as supposed, what could be wrong? HELP, please!
The same problem is in my project also. What can we do for solution Muhammed? Is 5V LCD's capable to work with 3.3V logic level controllers? Did you use special display or regular display?
I used lot's of lib including yours. Your lib was the best . But I have a problem Lcd's first line in completely on and second line is completely off(and it dont show anything). Might I connect lcd in a wrong way or the problem is sth else.?
Hello, i have a STM32F4 and the LCD DEM16216. The code works fine but there is nothing printed on the LCD. I have no idea what is wrong. Maybe i could send u my code and u have a look?
hello sir, I have done the same thing which is showed in the video and the connections are Vss-> GND, Vdd-> 5v, V0-> no connection, RS->PE0, RW-> GND, E-> PE1, D0-D3 -> no connection, D4-D7 -> PD8-PD11, A->5v, k->GND. But I am not getting the data on lcd. May I know the reason. Is it because of potentiometer?
Hello, I am using STM32F3 dISCOVERY board with 16x2 RG1602 LCD. when I build code with 8 bit mode command LCD works and display is cleared but when I try to print anything rectangle block shows up in first row. I have only changed the header file name to stm32f3xx instead of f4.
This was a good one, I just got it working but had to use another video that helped. I had to change the header file on your driver to match my board. I will post the link next: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-hZRL8luuPb8.html I had to setup the LCD without the STM micro first. The URL you mentioned showed the device with the pullup resistors and that can work but to match your code using only hardware, I had to make the resistors as pulldown ensuring that the ground voltage was in the milliamps, so I ended up using not 4.7K but 2.7K ohm resistors. I also used 10K potentionmeters for the contrast (VO) and brightness (VEE). The respective voltages I got were for (VO) 1.061 Volts and for (VEE) 3.178 Volts. But if anybody is looking at my post check the URL's Mohammed (MYaqoobEmbedded) gave but also look at the one I gave as well.
@@mutexembedded2206 Hi sir,Tnx for your brilliant channel, I used our library for the stm32f334 and as you said changed the #include stm32f3xx_hal.h but still there is an error which says "cannot open source input file stm32f4xx_hal.h as if the keil uvision searches for it. Could you please help me?
I adapted your library for stm32f0 but it doesent working.I think I am failing somewhere without realizing.Can you help me for the problem? and I'm also using 4bit mode
I did it bro.I also tried on 8bit mode.Im trying on stm32f0discovery board but still have some problem.Your code using TIM3(timer3) and I didnt define as be TIM3 on stm32cubemx.I wonder about my lcd driver is ST7066U .I compared ST7066U and HD44780.They have same register.There is noting on screen.Is there any suggestion to solve this problem?.Can you send me your board connection setup between lcd please?.Are you supporting LCD 3v or 5v?
Does anyone knows why 0x80 and 0xc0 are chosen in the function void LCD1602_setCursor(uint8_t row, uint8_t col)? I'm trying to understand the Hitachi manual but I cannot find what I'm doing wrong. Thanks
Ok, I solved. You just have to change the if conditions by a switch(row) case 1: maskData = 0x80 case 2: maskData = 0xC0 case 3: maskData = 0x94 case 4: maskData = 0xD4
@@mutexembedded2206 Thank you for such a quick reply, I'll check the latest i2c driver, I was curious here to know what I might have missed for it not to work.
@@mutexembedded2206 I have done that , is that it, is there gonna be a problem with timer, I believe same would work for microsecond delay function as timer 3 is present the device i have mentioned.Thank you.
Hi Dear; I have checked library with my nucleo and its working fine. But I want to know what is the solution if I want to use 20*4 LCD size, is there any global/universal solution ? Or which type of changes in current lib will make usable for 20*4 ? My another question iss why you fix port numbers in this case ???? Thanks for your video..........
@@mutexembedded2206 Thanks Dear for quick reply, I have tried yesterday there are two changes in Set cursor position function, Now I am able to write down in 3rd row but still unable to display character on 17th column (looks like library considering it like 16*4 LCD DISPLAY)
hello sir,I am using stm32f072rb,and im not able to add the (.h)file providing by your link.what should suitable format for (.c &.h) file.and how to addHAL libraries. PLZ provide me both file.
i appreciate your work it really help alot. I want to make semester project based on STM32F407VG the working of the project is to get temperature from DHT11 and live display it on LCd(16×2) if the Temperature increases from 30°, the fan will start and when temperature become 30°, fan stops. But i didn't find any help for this project i need circuit diagram. will you help me on this ?
Hi Syed, In brief, you need to do the following with Hardware: 1. Connect the LCD16x2 to specific pins on STM32. 2. Connect the DHT22 or DHT11 to VCC, GND and Data on STM32. 3. For the Fan control, you might use Relay or Mosfet switching. Just look at how to connect each with your STM32 individually, you will quickly figure out how to connect them all together with your STM32,, it is not hard, I am sure you will figure it out. Good Luck
Hello sir Can you tell me why my discovery access from external power supply? When I connect it to my laptop then it works but when I connect external power then no response by my stm32f4 discovery board Plz give me solution sir
surinder bansal Hi, It's the ST Link keeping the MCU at reset when communication to pc is lost.. You can solve this by upgrading your ST Link Firmware.
I really like your function *LCD1602_TIM_MicorSecDelay(uint32_t uSecDelay)* :)) Your have setting for *TIM3* for CubeMX ? *( LCD1602_TIM_Config )* Or write your setting of *TIM3* as text please! I can read code on CMSIS & registers in *LCD1602_TIM_Config* , but I'm not sure that I will read the code correctly
@@wajdisanchou In your case it is pretty straightforward. You just have to change: a) STM_MY_LCD16X2.c file >> void LCD1602_print(char string[]) >> i> void LCD1602_PrintInt(int number) >> char numStr[20]; b) STM_MY_LCD16X2.c file >> void LCD1602_PrintFloat(float number, int decimalPoints) >> char numStr[20]; And it works fine. My problem is still adding new rows because I don't really understand the variable maskData
@@wajdisanchou besides changing the aforementioned things, you need to modify the if conditions by a switch(row) case 1: maskData = 0x80 case 2: maskData = 0xC0 case 3: maskData = 0x94 case 4: maskData = 0xD4
I followed procedure as per video but getting error in function LCD1602_Begin8BIT() . The error is "expected a type specifier" . Please anyone can help me to rectify the issue. I think something is related with parameters passing with the function.
Rick JR Hi Rick, You would need to do a little change in the .h file of the lcd driver: Change the #include "stm32f4xx_hal.h" To #include "stm32l4...h" (your device specific)
Thank you very much already try that but it generates some mistakes in STM_MY_LCD16X2.c in the section Enable clock for TIM2 timer on line number 110 from RCC-> APB1ENR and all lines of TIM3. I do not know if you could help me one more time JL
Hi Rick, The library uses TIM3 for LCD timing,,, but the STM32L432 series does not contain a TIM3,, you can use TIM2, TIM15 & TIM16 as General purpose timer. So, you just need to replace all TIM3 by TIM2 and to use TIM2 instead ,, in 2 functions: LCD1602_TIM_Config() & LCD1602_TIM_MicorSecDelay() And you will get a working LCD! GL
ok it works, I only have a mistake in STM_MY_LCD16X2.c in the line RCC-> APB1ENR | = RCC_APB1ENR_TIM2 EN; it's only that, please would you give me a solution
I fixed my problem. ( Still i can't write float.) If you use different Ports, you can't use this library. For example D0-D7 must be in GPIOF or GPIOB etc. If you seperate the pins to different ports, library crashes.
hello sir, Thanks for LCD tutorial.Last week we have discussed about frequency generation. I have one question about frequency reading.i am working on STM32F429Zi Discovery board. can I use edge count/timer interrupt and CCP for frequency reading? do you have any solution for this please help me? otherwise give me any reference of your tutorial? Thanks and Regards, Rohit R Patil
Hi Mohamed, been following all your tutorials and I learned a lot! thanks! I have a problem though, i am getting an "error #79: expected a type specifier" on my declaration of LCD begin. hope you can help :)
I made the circuit and put the diagram into an image for people to download. (LINK BELOW) I made the circuit to have a manual option to test the circuit without the MCU. This way you can ensure the circuit works before testing the code on the MCU. You may have to play around with the pot values I got 2.8 volts on vee and .65 start to put 1.3 volts by V0. My circuit diagram uses pull down resistors which worked for me. Check the datasheet to manually put in the letters. rbaz.tripod.com/code/16x2_Circuit_Diagram.jpeg
Hi rwbazillion, Amazing mate, good work. I wish I have some freetime to make some videos for this and the update you made to the LCD library., it is very busy period for me. Keep up the good work though :)
HI Haldun, i am not if it will be a simple change in the library... I have not worked with LCD 16x4 before,, I would say, just look at an Arduino library for 16x4 LCD and compare it with this,, and see how you can adapt it to 16x4. I might update the library to do that if that turned out to be simple enough, if I had time over the next month. Good luck
Hello again Mohamed, I solved custom characters fuctions problem but only for 8 custom characters . I added a few functions in your library and changed library name :) . Now the library name is "AlphaNumericLCD", because the library supports 1x16 to 4x16 alphanumeric LCD... as well as I worked and tested STM32F1XX and STM32F4XX. it's working!. if you would like to download library and example drive.google.com/open?id=1ToDRtBM0RKWhPkXMmJD1ZkUxtlUm54dg drive.google.com/open?id=1iaho-Z4AtwO_ZMELWl_jX8yQgDnYQV9o I will wait for the updated video on the subject, and hope you will not forget to thank me on the update video :D
Haldun Turan Hi Haldun, Good job! I will make another video for this extended library.. Will mention you in the header as the editor and the list of functions you've written/contributed. Thanks again mate :)
I used timer3 on my project when i try use your liblary its broke my project.I think your project use tim3 so changed my timer to 2.But still got problem unable word do you have a idea about this problem? I use uart spi adc on the same project