News:

Let's find out together what makes a PIC Tick!

Main Menu

Fault finding why a i2c LCD is not working

Started by TimB, Aug 28, 2022, 01:19 PM

Previous topic - Next topic

TimB

Hi all

I have a couple of i2c LCD displays. They are the pcf8574 board on a standard 2 x 16 text LCD. The chips are Philips so pcf8574at.

I pulled them from my parts bin. But I cannot get either to work.

From the Philips pcf8574at data sheet the bas address is %0111xxx0 where xxx are A0, A1 and A2
One board has A1-A3 linked the other not. Since the lines are normally pulled high and link is to ground the address will be %01111110 for the board with no links and %01110000 for the board with the links

Now my issue is that neither work using the appropriate address. Using a scope I can see i2c activity on the SDA and SDC lines, but nothing happens on the screen. There is no data from the pcf8574 to the LCD lines.
BTW I have tried adjusting the contrast and in a VSM (with corrected address) the code works

So my question is, is there something else? Any way I can test if the pcf8574 is working?

I do have another i2c LCD on order but that might not arrive until Wednesday

Thanks
Tim

Dompie

Tim, have you performed a I2C scan for the correct I2C address of the pcf8574at?
You have I2C activity but no data to the LCD so probably the used I2C address isn't correct?

Johan
 

See_Mos

#2
It's a while since I did some work with the PCF8574 and there were some errors with the Proteus model which Ettore sorted for me.  Are the pins strapped high or low or floating?  I think I had to bias mine one way or the other and not leave them floating.

My simulation shows a base address of $70 if the address pins are all high or $40 of all are low.

I did my tests at HBus_Bitrate 100 and simply used HBusOut ob01000010, [A] or HBusOut ob01110000, [A], where [A] is the value to send.

I was simply driving LED's or reading inputs but you will need to send the code to initialise the LCD, but of course you knew that already.

TimB


Well I took Dompie's advice and cycled through the addresses

The LCD now has text on it. Only issue is I do not know the address that worked :(

But at least I know it works. Its a case now of narrowing it down by trying 0-127, 128 to 254, etc etc

One thing is you can run it fast as the text does not get changed once it fails to address it properly





TimB


Ok before you say the obvious. I know print the address to the screen...

TimB


Well it seems that I had the address right but something else is effecting it. Some times it works other times not, Every time data is not written right

Dompie

On the old forum there was a discussion over the differences between 8574 and 8574A
In my .inc file there is this line for the differences:
;I2CPrint_Control = %01000000(=8574) or %01110000(=8574A)
and it is used in the line:
Symbol I2CPrint_Address        = I2CPrint_Control + I2CPrint_Part_address

This I2CPrint_Address is used as the I2C address (ie HBusOut I2CPrint_Address, [I2CPrint_Init1_E]      ; E hi and send command nibble 0011 (3)  )

I don't know if this is of any help but I cant find the old discussion perhaps other people know

Johan

TimB



One thing to note is that I'm using the software i2c routines

Not sorted this yet. I can see that it has the right address as the backlight Led flashes

In the code the initialising code uses BSart and BEnd the rest does not, I have tried every combination. Now nothing works except flashing the Led

Dompie

I checked the source to see what exactly happened and the two lines in post #6 are a very difficult way to make the two I2C addresses $27 (8574) and $37 (8574A).
@Tim, forget post #6 as it contains no useful information at all, sorry.

Johan

keytapper

Ignorance comes with a cost

TimB


Well I finally have it working thanks to Gabi

The issues were many fold. The main being the use of BStart and BStop in some of the code. That was removed. Next was the port I was using. The firewing boards have really odd pin outs. D0-D8 uses ports from all over the place. I moved my connections to portB.0 and PortB.1 (A0 and A5 of the board, go figure that out!)
Then you have to power cycle the board and then press the reset button and eventually the LCD cames to life.

It turns out I did the right thing in ordering a new LCD as 1 line on the LCD not working and the other has half of Line 2 not displaying.

At least now the code works

Tim