João Costa @JD557@blog.joaocosta.eu Follow

Portuguese software engineer at Kevel.

My instance is running on a small server so please #nobot

Web

https://www.joaocosta.eu/

GitHub

https://github.com/JD557

Twitter

https://twitter.com/JD557

Itch.io

https://jd557.itch.io

  • Notes
  • Articles 6
  • Followers 52
  • Following 60
João Costa's avatar
João Costa
@JD557@blog.joaocosta.eu

Was writing some code to interact with a small LCD screen (Keyestudio KS0061) which, from what I understand, is controlled by a HD44780 Hitachi driver with a PCF8574 I2C port expander on top (so you can interact with it via I2C).

I got it to work, but for something that's I2C, this whole thing is way weirder than I expected... For the initialization routine I'm sending the same command multiple times with precise timings while turning on and off a flag... Maybe I'm just not that used to hardware programming. 😵‍💫

I'm still not sure the Enable bit pulse works though... The datasheets makes me believe that I need to pulse the enabled bit 4 times to send the data (so, something like [1, 0, 1, 0]).

Looking at how other libraries handle this, however:

  • In RPLCD, the bit goes [0, 0, 1, 0]
  • In PCF8574-HD44780-LCD, the bit goes [1, 0, 1, 0]
  • In LiquidCrystal_I2C, the bit goes [0, 1, 0]

Surprisingly, I can only get this to work by going [0, 0, 1, 0], which makes absolutely no sense to me... But I guess I can't argue with "it works" 😂.

PCF8574-HD44780-LCD/pcf8574.c at master · v0idv0id/PCF8574-HD44780-LCD GitHub
  • permalink
  • interact from your instance
  • 4 hours ago
Powered by microblog.pub 2.0.0+dev (source code) and the ActivityPub protocol. Admin.