https://www.nxp.com/docs/en/data-sheet/PCF8574_PCF8574A.pdf
https://images-na.ssl-images-amazon.com/images/I/51fDBZV-ebL._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.
PSUDO CODE
for (i=0x0; i<FF;i+=2)
{
START SPI
Send LCD ADDRESS
Send Data(i)
STOP SPI
}
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)
http://wiki.friendlyarm.com/wiki/images/f/f1/Lcdpcb.png
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/PCF8574_PCF8574A.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.
[EXAMPLE]
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.
https://images-na.ssl-images-amazon.com/images/I/51fDBZV-ebL._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.
PSUDO CODE
for (i=0x0; i<FF;i+=2)
{
START SPI
Send LCD ADDRESS
Send Data(i)
STOP SPI
}
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)
http://wiki.friendlyarm.com/wiki/images/f/f1/Lcdpcb.png
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/PCF8574_PCF8574A.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.
[EXAMPLE]
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.