Skip to main content
moranf
Associate II
November 29, 2017
Question

STM32L073 HAL_LCD_Write function

  • November 29, 2017
  • 5 replies
  • 2780 views
Posted on November 29, 2017 at 09:01

Hello,

I'm working on a custom board : stm32l073 + LCD screen ( matrix 4 x 25 ).

I can't understand how to use HAL_LCD_Write function.

As far as I understand I just need 3 parameters in order to write LCD : 

COM: 0-3 

SEG : 0 - 24 

DATA : 0 - 1 ( yes/no )

Or can someone explain the function note :

* @note For LCD glass COM*SEG as 8*40 for example, the LCD common terminals COM[0,7]

* are mapped on 32bits LCD_RAM_REGISTER[0,14] according to rules: COM(n) spread

* on LCD_RAM_REGISTER(2*n) and LCD_RAM_REGISTER(2*n+1).The segment terminals

* SEG[0,39] of COM(n) correspond to LSB bits of related LCD_RAM_REGISTER(2*n)[0,31]

* and LCD_RAM_REGISTER(2*n+1)[0,7]

Please advise

Moran.

#lcd #stm32l073 #hal
This topic has been closed for replies.

5 replies

ST Technical Moderator
November 29, 2017
Posted on November 29, 2017 at 09:59

Hello,

HAL_LCD_Write function writes to the LCD RAM memory:

HAL_StatusTypeDef  HAL_LCD_Write (LCD_HandleTypeDef * hlcd, uint32_t RAMRegisterIndex, uint32_t RAMRegisterMask, uint32_t Data) 

You can have a look to the

http://www.st.com/content/ccc/resource/technical/document/user_manual/41/78/8e/63/f9/32/44/12/DM00113898.pdf/files/DM00113898.pdf/jcr:content/translations/en.DM00113898.pdf

User Manual Description of STM32L0 HAL and Low Layer drivers0690X00000608tsQAA.png0690X000006090nQAA.png

Best Regards

Imen

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Thanks
moranf
moranfAuthor
Associate II
November 29, 2017
Posted on November 29, 2017 at 12:17

Hi Imen,

I've already looked at the HAL user manual, but it doesn't help.

I don't know if it's only me or not but I can't understand what should I write to each parameter of this function.

Thanks in advance.

MarCe
Visitor II
March 5, 2019

Hi Moranf I have the same problem.

did you have some solution?

waclawek.jan
Super User
March 15, 2020

As Imen pointed out above, HAL_LCD_Write() does not perform any seg/com decoding, it simply writes to one of the LCD module's RAM positions, refer to the LCD chapter in RM.

But the mapping is pretty straighforward: pixels (segments) corresponding to COM0 are in RAM[0] and RAM[1] (i.e. COM0SEG0 is bit 0 in RAM[0], COM0SEG1 is bit 1 in RAM[0] etc.), COM1->RAM2 and RAM3, etc.

JW