PCA9538 I2C IO Expander
This 8-bit I/O expander for the two-line bidirectional bus (I2C) is designed for 2.3-V to 5.5-V VCC operation. It provides general-purpose remote I/O expansion for most microcontroller families via the I2C interface [serial clock (SCL), serial data (SDA)].
Features
- Low Standby Current Consumption of 1 µA Max
- I2C to Parallel Port Expander
- Open-Drain Active-Low Interrupt Output
- Active-Low Reset Input
- Operating Power-Supply Voltage Range of 2.3 V to 5.5 V
- 5-V Tolerant I/O Ports
- 400-kHz Fast I2C Bus
- Two Hardware Address Pins Allow up to Four Devices on the I2C/SMBus
- Input/Output Configuration Register
- Polarity Inversion Register
- Noise Filter on SCL/SDA Inputs
#include "mbed.h" #include "PCA9538.h" //PCA9538 MyExpand(p9,p10,0x70,p21); DigitalOut myled(LED1); DigitalOut myled2(LED2); PCA9538PinOut myled3(exp_p4,p9,p10,0x70); PCA9538PinOut myled4(exp_p7,p9,p10,0x70); PCA9538PinIn mypuls(exp_p0,p9,p10,0x70); //void vISRExpand(void); int main() { //MyExpand.vInit(0x0F,&vISRExpand); //MyExpand.vWrite(0x00); while(1) { if(mypuls==0){ myled2=1; wait(0.3); myled2=0; wait(0.3); }else{ myled3=1; myled4=1; myled=myled3; wait(0.5); myled = 0; myled3=0; myled4=0; wait(0.5); } } } /*void vISRExpand(void){ myled2=!myled2; MyExpand.vWrite(MyExpand.cRead()<<4); }*/
Import programPCA9538_example
Example PCA9538 I2C Expander
Library:
Import libraryPCA9538_Expander
PCA9538 I2C Expander