7 years, 11 months ago.

Extremely slow LCD printf


First. Thanx for a great LCD lib.

I have a problem with my LCD. It is SOOO slow. When I execute the code, will it take around 10ms pr collom. And my system i going with 72Mhz.

I running a standart 20x4 LCD, on a Nucleo F103RB board.

Can anyone help my please. :)


Regaards Rasmus

Question relating to:

1 Answer

7 years, 11 months ago.

Checking the source code, it uses per character 2 writes. Each write includes 4 waits of 40us. Lets add some GPIO time overhead and other stuff, and round it to 50us. So each character takes 2 * 4 * 50us = 400us. You have 20 characters in a row (I assume you mean per row), which brings the total to 8ms. So seems to be working as expected :). You can make the delays less in the code and see if it still works.

Accepted Answer

Hei Erik Thank U for your answer.

No I mean per charactor. so 20x 10ms. = 2 sec for a rov. (Even more acully) And thats with the "fast" LCD lib i just found. :)

posted by Rasmus Thorsager 04 Aug 2016

That cant be right. There is either something wrong with the nucleo clockfrequency, or more likely, an issue with your code (eg lots of interrupts). Have you tested with the LCD helloworld example. How does that behave. Post your code if its not too large.

posted by Wim Huiskamp 04 Aug 2016

/media/uploads/Thorsager/img_3378.mov Thats what i thought. When im running the display on my Arduino, it is incredble fast.

Here is my testcode:

  1. include "mbed.h"
  2. include "NewTextLCD.h"

TextLCD lcd(D9, D8, D7, D6, D5, D4, TextLCD::LCD20x4); rs, e, d4-d7

int main()


lcd.printf("SysClk %d Hz", SystemCoreClock); Systemclock i running 72000000Hz

wait(2.0); lcd.cls();



lcd.printf("01234567890123456789"); This line takes 2,5sec, so the hole 20x4 LCD takes around 10 sec.



posted by Rasmus Thorsager 04 Aug 2016