Cannot get the PCF8574 working.
jtilghman
Posts: 67
Cannot get the PCF8574 working.
I have it connected and working with a Arduino. I then hook it up to the Prop and I can't seem to get it to work.
I am using http://obex.parallax.com/objects/271/ driver.
Not sure what to try, I have a logic analyzer connected and the data coming across the bus looks different from the prop than from the arduiino.
I am using 20h as the address, but i have tried others. The driver says that it is based on another driver that is in the OBEX but for some reason I cannot find any other driver but that one.
Here is the code I am using:
If there is any information I left out or anything to try, please let me know.
My goal is to be able to add some more I/O to the prop I am trying to use on my robot.
Thanks,
JT
I have it connected and working with a Arduino. I then hook it up to the Prop and I can't seem to get it to work.
I am using http://obex.parallax.com/objects/271/ driver.
Not sure what to try, I have a logic analyzer connected and the data coming across the bus looks different from the prop than from the arduiino.
I am using 20h as the address, but i have tried others. The driver says that it is based on another driver that is in the OBEX but for some reason I cannot find any other driver but that one.
Here is the code I am using:
CON _clkmode = xtal1 + pll16x _xinfreq = 5_000_000 SCL = 15 'PCF8574 Serial ClK line SDA = 14 'PCF8574 Serial DATA line ADDR = 20 'PCF8574A I2C Address (A0, A1, A2 all pulled low) OBJ IO : "PCF8574_Driver" PUB Main IO.Set_Pins(SCL, SDA) IO.Initialize REPEAT IO.OUT(ADDR, 001111) IO.OUT(ADDR, 000000) IO.OUT(ADDR, 001111) IO.OUT(ADDR, 000000) IO.OUT(ADDR, 001111) IO.OUT(ADDR, 000000) IO.OUT(ADDR, 001111) IO.OUT(ADDR, 000000) IO.OUT(ADDR, 001111) {{
If there is any information I left out or anything to try, please let me know.
My goal is to be able to add some more I/O to the prop I am trying to use on my robot.
Thanks,
JT
Comments
Not sure about the driver but it should work however I recently used a PCF8574 but since it had to run from a 5V supply I put a red LED in series with the supply to lower the logic thresholds so that it would work with the Prop. The chip can work directly from 3.3V though. You do have pullup resistors on the SDA and SCL, right?
Yes I have pull ups when using it either.
As to the driver, its all I could find. Was thinking of trying 12 blocks to talk to it, but haven't got about how to use 12 blocks yet.
Just trying to turn some LEDs on and off. How hard could it be. lol
http://www.rayslogic.com/propeller/programming/i2c/i2c.htm
BTW: I'd highly recommend upgrading to the newer PCA9554...
If you had Tachyon Forth loaded then it would be very very easy, you would have it running in under 30 seconds. Less since you could copy and paste this code:
Hey Rayman: Why would I want that one over this one ? and I am just trying to use what I have already.
Hey Peter, I might have to give that a try. Still trying to wrap my head around SPIN.
Thanks,
jt
I will post it here, I most likely haven't got it setup correctly.
Sorry if I didn't get it correct, I still learning SPIN.
Thanks for trying.
JT
No problems, but unlike SPIN it happens to be interactive so all you need to do is load Tachyon onto your board and connect up a serial terminal at 230400 baud (unless you change the default). Being interactive you can quickly spot the problem for instance by making sure that the "command" I2CBUS detects it. Ya just gotta try it.
I use a program that I found in one of the other threads here called I2CSCAN and it can see the EXPANDER just fine.
Here is the output:
So it kind of works.
Thanks,
JT
I ordered some PCA9554's, they will be here today.
I will let you know how they do.
Thanks,
JT
Two things: You clobbered my working object, and you completely missed the mark in usage. Also, even if you had done it correctly you may have not seen things working because you have no delays between your pattern outputs.
Here's a partial listing that should be helpful. Download and overwrite my object (to restore it to working order) and then give this code a try.
Are you sure you have a PCF8574? According to the documentation, the address should be %0100_AAA_0 -- that is, with $4 in the upper nibble, not $2 as your scan indicates.
I am sorry I messed up calling the object. I am still new to SPIN and for the most part it seems to makes, not all of it tho.
As to the PCF8574, the chip came from DigiKey and says its NXP PCF8574 , I also just got some PCA9554 as, but no luck with them either.
I will try and make your code snippet from the last post work and update on my progress.
I thank you for your time and effort trying to help me, am I just a little slow at some of these things.
Thanks,
jt