STM32F4 Discovery board - Keil 5 IDE with CubeMX: Tutorial 11 LCD16x2 - Updated Dec 2017
HTML-код
- Опубликовано: 5 сен 2024
- 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.c...
Very good library. Managed to print text onto LCD with great success. Thanks Mohammed.
Worked on my F303 from the first try. Thanks Mohamed for this awesome library!
Mine is not working with same board . Anything else you did other than renaming stm32f3xx_hal header ?
working with lcd rg1602
Hi even it did not worked for me.
Thank you, was a bit harder to do in microvision without HAL, so I had to initialize all the ports and do a lot of makros but this helped!!!
Perfect explanation, worked like a charm, thank you!
Hi ,can I get the project which worked?
hi,thank u sooooooooooooooooooooooooooo much .please continue these education.ur prespectives are admirable.thank u again.
Thanks Mahdi
دمت گرم(In Persian)
Thank you very very much
:)
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"
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 will re-do this tutorial with an I2C LCD 16x2 display.
Hi Sir,
Can i get the source code for this project? LCD is not displaying the text. Kindly help
Hi,
I don't think I have the project files anymore. I am planning on updating this project for a much better version that works on more boards
What do I have to change to use this library with 20x4 LCD display?
Or can I just set cursor in "extended address" and write there?
I have the same problem, did you find the solution ?
perfect man :) hello in TURKEY :)
Excellent tutorial. Learned a lot!
Thank you so much for this explain video. It has been so understandable.
Nasıl yaptın?
Works with STM32F030R8, thanks for sharing.
There is one problem, can't print float numbers. Print int works fine, any suggestions?
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..........
For 20*4, you need to modify configuration part I believe, I will can do that and put a video for everyone next
@@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)
@@jaydeepshah2026 Hi, nice job, check out the range protection that this library does and unrestrict to 20 cols
@@jaydeepshah2026 Could you please help me regarding 20x4 LCD interfacing with STM32F407
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
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 :)
please help me! i used your library for stm32f103 board.but the text is not displayed on the lcd
Hi,
Changed the header to stm32f1xx.h ?
@@mutexembedded2206 i changed to stm32f1xx_hal.h but still the same
Adjust brightness 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.
Hi,
I will update this driver and fix this issue.
@@mutexembedded2206 Thanks
@@mutexembedded2206 Is the issue resolved ?
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.
how to used the stm32 cryptographic library or PBC cryptographic library in STM32F4DISCOVERY?
excellent videos
Any plan to make a series and evalution of ESP32?
I would love to hear your thoughts
cheers
Hala Abo Al-Sous
Not sure if I will make some on ESP32 :))
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
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,
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?
Hi,
Do you still have the issue?
@@mutexembedded2206
Hello, i have found the problem.
Thanks for your response
Great!
What was it? will be cool if you can share it here too.
Surely for 4-bit mode you can't simply delete D0-D3? Is there no Init4bit () command?
can use this code for stm32401re nucleo boards
Hello, I have the error in c. file, line 111: RCC->APB1ENR |= RCC_APB1ENR_TIM3EN;
I am using STM32L476RG and don't know what to do.
Thanks in advance!
Hi, ]
How would I do this with a 4 line LCD?
same prob
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!
Same issue. Did you solved your problem?
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.
What's your line of code looks like
@@mutexembedded2206 void LCD1602_Begin8BIT(RS_GPIO_Port, RS_Pin, EN_Pin, D0_GPIO_Port, D0_Pin, D1_Pin, D2_Pin, D3_Pin, D4_GPIO_Port, D4_Pin, D5_Pin, D6_Pin, D7_Pin); getting error in this function.
@@mutexembedded2206 Total 13-errors as expected a type specifier.
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?
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.
thank you,i have a problem,can i use this library for stm32f1xx ?
Hello, thank you for the good tutorial! I have got nucleo f070rb and everything works fine except displaying float numbers. Any idea? Tks.
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, 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 ?
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.
What kind of changes do I need to make if I want to use Port E Pin
Mate you know what? I love you!!!
Haha, thanks!
could we modify the library to work on stm32f103c8? thankx
NOT WORKING STUCK IN SysTick_Handler HELP ME PLZ..
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.
the same for me if you find the solution please answer me
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?
C B Harshitha
Yes, you need a potentiometer.
Actually potentiometer is to change the brightness of the LCD right?
And also can you tell me the potentiometer connections to STM board
Hi,
Just need power 3v and GND, then common to VO. Very straight forward
Ok sir, Thanks for the information :)
Sir, could you tell me how to create a millis() function in stm32 like in arduino?
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.
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
Thanks succesfully print text to LCD.
i have tried change to 20x4 lcd screen, but I can not do that. can u help me?
Where can I find the lcd driver. Files stm_my_lcd.c and .h file.could u please share me the link
hello sir! can i use it for stm32f103c8t6 for my LCD...
Btw great tutorial searched so many videos but yours was very clear and to the point
Thanks!
but can i use it for my microcontroller?
Utsav Lal
Yes.. but you would need to change the include in the .h file from
#include "stm32f4xx_hal.h"
to
#include "stm32f1xx_hal.h"
Ok thank you very much....
@@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
Research OnElectronic
Hi,
You need to change the library .h file include from "stm32f4xx.h" to "stm32f0xx.h"
GL
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?
Research OnElectronic
Hi mate,
It is something to do with TIM3. STM32F0 do not utilize TIM3, use TIM2 instead. Replace all TIM3 instances with TIM2.
Ok bro I fixed it.Now its working well.The problem was contrast of LCD.Thanks for answers bro GL.
Research OnElectronic
Right, that was so simple! Nice one.
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.
Sure, i will give you a quick fix soon
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
Very Well, but i would like you to explain how to use the LCD without your libraries, how to create our own code. Cheers!!
Important information, this library use TIM3 ! To avoid any issues don't use it.
Hi Mohamed how are u ?, i wish that u make a video about how to program the LTDC of the stm32f429i-disco
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
@@mutexembedded2206 but "LCD_SET_DDADR" is signed as : undeclared identifier
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
Hi,
haha, I don't know
Hello,
I can't export the file .h
how can I solve this? thank you
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 ?
Syed Bilal
Hi Syed,
What sort of help do you need for your project, a code for DHT11, for example ?
MYaqoobEmbedded
Hello .
Actually i want to know how can i implement this project on hardware because i don't have any circuit diagram.
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
MYaqoobEmbedded
Thank you very much sir. :)
This may be naive but is there a reason you initialized a new timer (TIM3) instead of just using HAL_Delay? Thanks
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
@@mutexembedded2206 The way you did it was probably more professional. I'm glad I got to see an example of creating a custom timer anyway. Thanks!
hi, i am trying to use your tutorial on the Nucleo-l053r8 BOARD, does it work ?
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.
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.
Hi Anish,
Sorry for late reply, just saw yours now.
Do you still need help?
yes sir ,i really need your help
please provide me .c and .h file for lcd interfacing
Im using stm32f072rb
this is my email id- anee049@gmail.com
will it work on STM32F103C8 ALSO
Should do. But might require slight modification.
Can i use this library for stm32f0?
dalpus
Yes.. As long as you're using HAL libraries .. Good luck
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?
Hi Marcel,
You've got to do both in Embedded systems, so yeah Hardware and Software. Cheers
could you make a video on lcd2004 display using i2c?
Dose your Library support custom character?
M.R.F Iran
Nope
Hello Mohamed sir,I have watched all videos but I am not being able to connect STM board with Arduino over I2C protocol
Saurabh Jain
Hi Saurabh,
I replied to you on the I2C video :)
MohamedYaqoobSTM Sir can you suggest how to find the I2C address of Arduino
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:
ruclips.net/video/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.
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.?
M.R.F Iran
Hi M.R.F,
Do you still have the issue?
MYaqoobEmbedded yes . I still have this problem
Try using enable Two lines function:
LCD1602_TwoLines();
MYaqoobEmbedded thank you . I forgot to set tim3 . I set tim3 and now it's working . Thanks
Nice!
Hello, sir.
I have a 4x20 LCD display. What should I modify in your libraries? The instruction " LCD1602_setCursor(3,1); " doesn't work.
Thanks :)
I have the same problem I work with LCD 20*2, I didn't find the library.
@@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
@@pabloq3411 sorry I'm wrong I work also LCD 20*4 .. do u get any solution
@@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
@@pabloq3411 dosen't work, it work with you !! here is my mail would u contact me plz I'm student engineer just need some help wajdi.sansa@enis.tn
Can you explain the configuration of Timer3 (TIM3)? Please. ASAP
Hey
If you go through the library part of the code for TIM3, you will see it is just a normal timer counter till period elapsed.
MYaqoobEmbedded So... In channel 1 of TIM3 what I should choose?
you are speaking 'A YEAR AGO'? Then where is the original video? please add the older video link in the description of every carryforward video.
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
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.
surinder bansal
ruclips.net/video/Tt-eyglKpIs/видео.html
Thanks sir my problem is solve now
Muhammed Can you please help me? I can't use lcd with your library i did everything like yours. Can you get contact with me?
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.
I cannot open the .h and .c files. can you help?
Hi, Link is working.
You need to download the Zip folder from my Gdrive. GL
Your code uses TIM3. Please notice this.
Camilo A. Camacho
Yeah, that's right.. Forgot to mention that.
could you tell me what configuration should i do with tim3? thanks in advance
guys please how to configurate TIM3 ?
Hi,
What STM32 Board you're using?
@@mutexembedded2206 STM32F4 DISCOVERY
@@ramychokry4335Right,, did you have a problem with TIM3?
I fixed it its working now by the way thank you very much you have the best stm32 videos on youtube
@@ramychokry4335 Great, enjoy :)
Hi sir! Can you teach me how to choose multiple GPIO output in one time? Hope you rep soon! Thank you!
Hi,
Sorry for late reply. can use register directly
GPIOD-> BSRR = (1UL
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
rOHIT PATIL
Hi Patil,
Are you trying to measure a square wave's frequency ?
no sir,just i watching your i/o capture tutorial.
Ok Sir!
is this possible using Input capture?
rOHIT PATIL
You can use input capture to measure pulse width, and with this you can calculate the frequency.
Sir how can I shift cursor from left to right? I can't understand
You can shift Cursor with Set Cursor functions
I'm using but can't access
surinder bansal
What exactly you're to do and how it is not giving you what you want?
I'm directly using the shift cursor function I think I'm wrong here can u tell me how to use this function?
surinder bansal
This function sets cursor at X Row and Y Col. X from 1 to 2. Y from 1 to 16.
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 :)
How do I write my own LCD functions?
Need to add couple more functions to the library. described in the datasheet if you are to try.
Hi Sir,
Waiting for project..
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
Hi,
You can avoid using TIM3 in your project, it should solve the problem, assuming there is no more conflict with your current project.
plz provide me all connection as soon as possible......
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 :)
Will it work on STM32L053?
Hello Mohamed,
I reviewed your LCD Library and i want to work with 4x16 LCD. I want to change this functions for 3. and 4. rows.
void LCD1602_TwoLines(void)
{
FunctionSet |= (0x08);
LCD1602_writeCommand(FunctionSet);
}
void LCD1602_OneLine(void)
{
FunctionSet &= ~(0x08);
LCD1602_writeCommand(FunctionSet);
}
//
void LCD1602_setCursor(uint8_t row, uint8_t col)
{
uint8_t maskData;
maskData = (col-1)&0x0F;
if(row==1)
{
maskData |= (0x80);
LCD1602_writeCommand(maskData);
}
else
{
maskData |= (0xc0);
LCD1602_writeCommand(maskData);
}
}
What kind of changes should i do?
For example:
1. row = > maskData |= (0x80);
2. row = > maskData |= (0xc0);
3. row = > maskData |= (0x??);
4. row = > maskData |= (0x??);
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 my problem. I changed a few functıons in STM_MY_LCD16X2.c
1. changing function__________________________________
void LCD1602_setCursor(uint8_t row, uint8_t col)
{
uint8_t maskData;
maskData = (col-1)&0x0F;
if(row == 1) // 1. row
{
maskData |= (0x80);
LCD1602_writeCommand(maskData);
}
else if (row == 2) // 2. row
{
maskData |= (0xc0);
LCD1602_writeCommand(maskData);
}
else if (row == 3) // 3. row
{
maskData |= (0x90);
LCD1602_writeCommand(maskData);
}
else if (row == 4) // 4. row
{
maskData |= (0xd0);
LCD1602_writeCommand(maskData);
}
else // default 1. row
{
maskData |= (0x80);
LCD1602_writeCommand(maskData);
}
}
2. two adding function__________________________________
void LCD1602_1stLine(void) // 1. row
{
LCD1602_setCursor(1,1);
}
void LCD1602_2ndLine(void) // 2. row
{
LCD1602_setCursor(2,1);
}
void LCD1602_3ndLine(void) // 3. row
{
LCD1602_setCursor(3,1);
}
void LCD1602_4ndLine(void) // 4. row
{
LCD1602_setCursor(4,1);
}
you can add this to your library if you would like.
p.s : I will add custom characters functions and i will let you know.
Haldun Turan
That's Awesome!,, thanks Haldun :) Please do let me know if you managed to get the custom character function.. Good work mate!
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 :)
sir can you send the connection diagram
plz provide additional connection with lcd like potentiometer ......
oh yeah !!!
Hi myaqoob,
I wondering what would be the changes I need to do if I'm going to use this driver for stm32f103c8(blue pill).
Hi.. why not use the i2c version. This library is slightly outdated. I might update it if many need it.
@@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.
@@rahulg6563 Hi Rahul, there few things you need to change, like header include to #include "stm32f103xx.h"
@@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.
@@rahulg6563 yes you're right. It's something to do with Microsecond timer.
I suggest you replace all Microsecond delay with HAL_Delay(1)
I use the STM32L432KCU card could you help me to use an LCD
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
Hi
Just use the HAL library Macro:
__HAL_RCC_TIM2_CLK_ENABLE();