Posts: 24
Joined: Sat Apr 01, 2017 1:21 am


Postby AgentSmithers » Mon Oct 09, 2017 11:21 am

Hi Everyone,
Recently I purchased this I2C backpack and programmed I2C to work with NONOS SDK on my esp8266 Wemos D1 Mini Pro.

Does anyone know how the heck to tell this in i2c to sent hello world to the LCD screen? I can do it when I look up my 4BIT pins to it just fine but when using i2c I cant seem to find any details of the protocol anywhere, Everyone just wants to talk about gosh darn ardunio which dosnt help for jack.
Thank you!!
Post script: extra brownie points if any of you have an NONOS SDK libary for the LCD1602 via I2C.

User avatar
Posts: 467
Joined: Wed Jun 29, 2016 7:17 pm
Location: India


Postby pratik » Tue Oct 17, 2017 11:16 pm

The Device is just an IO expander (look at the chip part number). So you just have to implement the same stuff that 4 bit parallel does. But you have to use I2C to send the 4 bit states.
And PCF8574 library for nonOS SDK will work just fine. Not sure there is one that works with the LCD. But should be a day's work only.
Pratik Panda
Website: http://www.PratikPanda.com

Custom firmware, Knowledge base and freelancing (ESP8266/ESP32):

Posts: 24
Joined: Sat Apr 01, 2017 1:21 am


Postby AgentSmithers » Thu Oct 19, 2017 12:47 am

Thanks Pratik, I made alot of progress on this doing it without the Library. I think another day or two and I'll have this wrapped up.
I always appreciate your response.

This is where I am currently.
https://www.nxp.com/docs/en/data-sheet/ ... F8574A.pdf
https://images-na.ssl-images-amazon.com ... SY355_.jpg

Hi Everyone,
I don't know how well acquainted you are with the backpack PFC8574 but it seems I connected to the device via SPI.
I then created a FOR LOOP sending predictable data to it.

for (i=0x0; i<FF;i+=2)
Send Data(i)

Before I ran the code I hooked a bunch of LED's to the Pin Extender and saw what order they flashed with the Hex codes and it appears that with a Pinout that soldiers to the LCD screen it looks like this (The pin outs match of course)

Now what I noticed is that the last 4 bits of the Data control the D4,D5,D6,D7 on the pinout to the LCD and values 9-15 (In binary) control the other three pins connect to the RS,E and RW pins on the LCD1602.

Does anyone know any Pseudo code or very basic easy to read code that will handle just the basic functions of this translation?

Correct me if I'm wrong but at my ESP it seems like I am going to take a string, Break it up then remove the bottom 4 bits using an AND operation, then apply the RS,E,RW pins using an or operation then send that value to the Backpack to Toggle the correct Pin's then bitshift the last 4 its of the char rinse and repeat (Of course not to forget to toggle the 'E' bit along with the last 4 bits of the char to be sent to tell the LCD to process it).

I think I'm pretty warm but wanted to make sure if I had it right. Is it possible the orientation of the 4 bits on the High Side are backwards (MSB vs LSB)?

Has anyone traveled down this road before?

One more thing to add, As I was bruteforcing with the Pseudo code above it seems that the hex values don't seem to match at all from what the Datasheet says.
https://www.nxp.com/docs/en/data-sheet/ ... F8574A.pdf

After reading here it seems that the hex values are all within 16 values either in the 0x4? or 0x7? range, but with the code above I am seeing that
the LED's are turning on just like the sample values below.
The 4 bits on the left are D4,D5,D6,D7 and the right on the right are RS,E,R/W and the 8th bit seems that it is a on or off flag to send RS,E,RW at all.
Like the values of 1-8(DEC) in binary are moot. In order to turn on RS,E,R/W you must send values 9-15(DEC) to toggle the three LED's in any combination.
0x19 Binary 00011001
0x29 Binary 00011001
0x39 Binary 00011001
0x49 Binary 00011001
0x59 Binary 00011001
0x69 Binary 00011001
0x79 Binary 00011001
0x89 Binary 00011001
0x99 Binary 00011001
0xA9 Binary 00011001
0xB9 Binary 00011001
0xC9 Binary 00011001
0xD9 Binary 00011001
0xE9 Binary 00011001
0xF9 Binary 00011001

Any help would be appreciated.
Thank you.

Who is online

Users browsing this forum: Bing [Bot] and 7 guests