Using PCA8574 with I2C

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Using PCA8574 with I2C

1,247 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by serge on Sun Apr 03 09:25:33 MST 2011
I am an absolute newbie concerning the LPC1343 AND programming in C :rolleyes:. Previously i always used 8052 (and derivatives) which i programmed in assembler:p.
Now I would love to use a LPC1343 combined with a pca8574 (I2C port expander). The sequence i need to send to the pca8574 to toggle an output for example is 01000000 11110111. The first byte is the address &H40, the second byte is just a data byte &HF7.
The few example programs i found are great to use EEPROM's where you first send the address then the number of bytes to send whereafter the data follows.
I also checked on the documentation (LPC1343 user manual section 12.5 page 192 and 193) where i find the same procedure: address, number of bytes to send (or read) and data.

Am i missing something in the documentation or do i mis-interpret the examplecode:p.

Can someone please help me?

I also need to figure out a way to connect an old-fashioned 2X40 char LCD (44780 compatible) to the LPC1343. I know it isn't fancy but i hope to get it to work. So if anyone has an idea how to connect it (32bit processors are new to me)...
0 Kudos
Reply
5 Replies

1,102 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by serge on Wed Apr 06 10:54:27 MST 2011
Thank you all for helping me out. As for the display... I was not going to use a 'fancy' display since the display will be used less than once each year. So a good old (and cheap:p) 44780 has to do the trick.

Serge
0 Kudos
Reply

1,102 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by larryvc on Sun Apr 03 14:32:36 MST 2011
jharwood thanks for posting lcd.zip.  Your timing could not have been better as I was about to modify some other code to achieve this.

I'm updating your code to use CMSISv2 but I haven't looked at the code carefully enough to determine what, if anything, will have to be changed.  This will be used on LPC11xx, LPC13xx, and LPC17xx. 

Although I do use the dog series displays I still have a few 44780 compatibles as well and I don't have to throw them away yet.:)

Note:
I'm putting off the update to CMSISv2 until CodeRedSupport and NXP confirm the current CMSISv2 as being the correct release as noted in another thread.  The code works great as is with CMSISv1.30.
0 Kudos
Reply

1,102 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by jharwood on Sun Apr 03 12:19:33 MST 2011
Take a look at [B]this thread[/B]. Rob65 posted a cleaned up version of the I2C example driver. (you'll need to port it from LPC11xx to LPC13xx though).

For the IO expander, you would simply need to place the two bytes in the write (aka master) buffer, set the write length to 2 and call the I2CEngine.

For your LCD, I have attached a copy of the code I have for a 44780 compatible, 4 x 20 character display operating in 4 bit write only mode. You will need to include the CMSISv1p30_LPC13xx library in your project, and modify the port and pin definitions as well as the display characteristics.
0 Kudos
Reply

1,102 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by larryvc on Sun Apr 03 09:57:48 MST 2011

Quote: Zero
Throw it away :) and use a modern 3.3V SPI display ...



Zero don't you want to encourage others to be green?:D  Recyle it and use the modern one.
0 Kudos
Reply

1,102 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Sun Apr 03 09:39:45 MST 2011
What about I2C sample with PCF8594 in example folder (LPCXpresssoxx/Examples/NXP/LPC1000/LPC13xx/examples.lpc13xx.new.zip) ?

Quote:

...I also need to figure out a way to connect an old-fashioned 2X40 char LCD (44780 compatible) to...


Throw it away :) and use a modern 3.3V SPI display ...

http://www.lcd-module.com/products/dog.html
0 Kudos
Reply