• PicŪ Basic


  • Port expansion using the PCA9554A

    The PCA9554 and PCA9554A are 16-pin CMOS devices that provide 8 bits of General Purpose parallel Input/Output expansion for I2C-bus/SMBus applications.
    The improvements include higher drive capability, 5 V I/O tolerance, lower supply current, individual I/O configuration, 400 kHz clock frequency, and smaller packaging.
    The PCA9554/PCA9554A consist of an 8-bit Configuration register (Input or Output selection); 8-bit Input Port register, 8-bit Output Port register and an 8-bit Polarity Inversion register (active HIGH or active LOW operation).

    The system master can enable the I/Os as either inputs or outputs by writing to the I/O configuration bits.
    The data for each input or output is kept in the corresponding Input Port or Output Port register.
    The polarity of the read register can be inverted with the Polarity Inversion register.

    Three hardware pins (A0, A1, A2) vary the fixed I2C-bus address and allow up to eight devices to share the same I2C-bus/SMBus. The PCA9554A is identical to the PCA9554 except that the fixed I2C-bus address is different allowing up to sixteen of these devices (eight of each) on the same I2C-bus/SMBus.



    Interrupt Mode:
    The PCA9554/PCA9554A open-drain interrupt output (/INT) is activated when any input state differs from its corresponding Input Port register state and is used to indicate to the system master that an input state has changed.
    The PCA9554A expander does not require a configuration register to run with interrupts.

    NOTE:
    Changing an I/O from and output to an input may cause a false interrupt to occur if the state of the pin does not match the contents of the Input Port register.
    The PCA9554_Write_IODIR(Direction) command takes care of this peculiarity and does not trigger a false interrupt.

    Writing to an output pin cannot cause an interrupt thanks to the configuration register. A special routine is provided in the demo file for running this test.

    Interrogation Mode:
    I added two special commands to read the GPIO port more quickly. See the PCA9554A manual page 11 in figure 14. It works like a Byte Mode functionality.
    The PCA9554_SetAddr_GPIO(CheckAck) command points to the GPIO register of the expander.
    The PCA9554_ReadFast_PORT(CheckAck) reads the PORT more quickly.
    The user could modify this code for his own special applications.

    The PCA9554B is a pin-to-pin replacement for the PCA9554, while the PCA9554C replaces the PCA9554A. Although pin-to-pin and I2C-bus address compatible with the PCF8574 series, software changes are required.The problem is resolved using this library.
    I tested the PCA9554A because I could not find the other expanders from my usual supplier.

    Note:
    I recommend RC filters in the inputs to reduce bounces. (for any expanders) You can find a filter example in the schematic. (Change the values for your application)

    As usual I wrote 4 libraries, normal and light.
    "PCA9554A-H.inc" using the hardware MMSP of the PIC(r).
    "PCA9554A-H_L.inc" using the hardware MMSP of the PIC(r) without testing the transmission Acknowledge.
    "PCA9554A-S.inc" using software I2C.
    "PCA9554A-S_L.inc" using software I2C without testing the transmission Acknowledge.

    CONCLUSION:
    Using the PCA9554A expander in interrupt mode is very easy, no hidden problems at all.
    Using the I2C bus at the highest speed can help working with the interrupt mode.
    The software library uses the file "Software_I2C.Inc" written by Les Johnson because it has the same structure of the HBUSOUT/HBUSIN commands. This file has been modified so please save your original file.

    The PCA9554B/PCA9554C are very simple and are a good replacement for the PCF8574/PCF8574A series to work bit to bit and in interrupt mode.
    Alberto Freixanet

    PCA9554A_Library.zip
  • Recent Activity

    joesaliba-353

    ASM Error with USART PIC 16F15325

    Thread Starter: Robertux

    Hello, if i try Hserout or Hserout1 I have a ASM error : Symbol not previously defined (PP_TXIF) With Hserin or Hserin1 the ASM error is : Symbol...

    joesaliba Yesterday, 17:22 Go to last post
    RGV250-614

    Wrong loader version

    Thread Starter: RGV250

    Hi, I have just had to re-install PDS (thanks to the latest windows10 update wrecking my laptop), I have compiler 3.6.0.3 but the loader is 1.0.2.1...

    RGV250 Today, 10:11 Go to last post