Shop OBEX P1 Docs P2 Docs Learn Events
pca9554an i/o expander — Parallax Forums

pca9554an i/o expander

stargazer2050stargazer2050 Posts: 89
edited 2013-05-27 18:32 in Propeller 1
Quickstart bd
Spin
Ray's logic 9554 spin
Converted his vga output to fullduplex
Dcc at 3.3 volts
10k pullups on sda and scl to 3.3v
Left int, a0 a1, a2 disconnected
Getting read error, write error

Help.
Another question, does.mike greens version do the 9554 and where to find it

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2013-05-26 08:44
    BoeBotBasic (from the ObEx) uses a PCA9554, but uses a different (PASM) I/O driver for I2C than Basic_I2C_Driver from the ObEx. Basic_I2C_Driver was used for testing this PCA9554 setup originally.

    In other words, if you've really hooked it up as described, it ought to work. Without more information (particularly source code), can't help you further.
  • stargazer2050stargazer2050 Posts: 89
    edited 2013-05-27 11:07
    Got sda scl pinouts corrected. Still getting read and write errors
    Wondering where address '32' comes from. Documentation talks of 0100000, 0100 100x.
    Are these 32 in some system?
    Is there spin to read the address off the chip directly?
  • JonnyMacJonnyMac Posts: 9,107
    edited 2013-05-27 11:36
    I don't remember why I wrote this (probably to help somebody else), but I found this object on my system -- see if it helps.

    Is there spin to read the address off the chip directly?


    In I2C the master knows the address of the device it's "talking" to. You could use an I2C buss sniffer to search your I2C buss and look for devices that are attached.
  • stargazer2050stargazer2050 Posts: 89
    edited 2013-05-27 12:11
    Hi jm

    i set up your program.
    How would.i go about using this.
    My level of knowledge is mechanical. So i would need a routine that i could access each input io variable.
    Ill be expanding to add bumpers and quadrature counters.
  • JonnyMacJonnyMac Posts: 9,107
    edited 2013-05-27 14:06
    That is not a program, it's an object that you can reference in your programs. If that doesn't make sense then I suggest you work your way through the PEK documentaiton which is connected to the Help menu of the Propeller Tool.

    As with all objects, you have to declare them. I don't know what you want to call that device, so let's do something like this:
    obj
    
      xpins : "jm_pca9554"
    


    Now you have to connect that object to the I2C buss -- that's what the .start method does.
    xpins.start(28, 29)
    


    ... would connect the object to the Propeller's EE buss.

    Finally, you can use methods in the object to work with one or more PCA955A devices on the buss -- note that the methods require a 3-bit address for the device you want to work with. If you had a device with A2, A1, and A0 pulled to ground (address %000), you could read its inputs like this:
    pins := xpins.rd_port(%000)
    


    For any part you want to use you really must study the documentation and object code provided for it.

    Finally, while you can use this kind of device to read remote inputs, you're not going to be able to read quadrature encoders with it. The latter requires constant monitoring, typically at a fixed rate. Unless you want to use the interrupt capability of the PCA9554 -- but that means another layer of complexity.

    As my friends in the Dallas Personal Robotics Group say... It's harder than it looks. That doesn't mean it's hard, it just takes a bit of study and effort.
  • stargazer2050stargazer2050 Posts: 89
    edited 2013-05-27 14:26
    That answered an even greater question!

    Thankyou very much

    Ill wait till next year and use the prop 2
  • JonnyMacJonnyMac Posts: 9,107
    edited 2013-05-27 17:30
    Ill wait till next year and use the prop 2

    A bird in the hand is worth two in the bush. Don't wait on the P2 -- Parallax is very careful about releases and it will probably take longer than they, or any of us, want to be release The P1 is available now, works well, and many of us have used it to read quadrature encoders (I even wrote about it in my Nuts & Volts column).
  • RaymanRayman Posts: 14,665
    edited 2013-05-27 17:49
    You know... There is an "A" version and a regular version of this chip...
    I think "32" is the base address for the regular version when all address chips are grounded.
    If you have the "A" version, PCA9554A, then your address will be different.

    BTW: They made the A version so you can have a lot of these chips on the same I2C bus...
  • Duane C. JohnsonDuane C. Johnson Posts: 955
    edited 2013-05-27 18:32
    See:
    Expander_PCA9554_8-bit-I2C-bus-and-SMBus-IO-port_MicroChip_DIP-16
    Look at section "6.5" for the base addressing stuff.

    Duane J
Sign In or Register to comment.