HelloWorld program for PCA9547: an I2C bus multiplexer control library. PCA9547 is an I2C multiplexer which enables to select 1:8 multiplexed I2C bus. The multiplexer is useful for deviding I2C bus to avoiding slave address conflict and separating capacitive loads. For more information about PCA9547: http://www.nxp.com/documents/data_sheet/PCA9547.pdf

Dependencies:   LM75B PCA9547 mbed

What is this?

This is a sample code to demonstrate the PCA9547. The PCA9547 is a 8 channel multiplexer for I2C bus.
The code shows how the bed can access the I2C device (LM75B) through PCA9547.

PCA9547_and_LM75B
Demo hardware block diagram

/media/uploads/okano/pca9547_connections.png
Connection between mbed and PCA9547

Information

For more information, please visit component page.

The PCA9547 is an octal bidirectional translating multiplexer controlled by the I2C-bus. The SCL/SDA upstream pair fans out to eight downstream pairs, or channels.

Files at this revision

API Documentation at this revision

Comitter:
okano
Date:
Mon Jun 30 23:57:31 2014 +0000
Child:
1:63d8f8d68f61
Commit message:
very first test code

Changed in this revision

LM75B.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LM75B.lib	Mon Jun 30 23:57:31 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/chris/code/LM75B/#6a70c9303bbe
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Jun 30 23:57:31 2014 +0000
@@ -0,0 +1,23 @@
+#include "mbed.h"
+#include "LM75B.h"
+
+
+I2C     i2c( p28, p27 );
+
+void set_pca9547( char ch )
+{
+    char    v   = 0x08 | ch;
+    i2c.write( 0xE0, &v, 1 );
+}
+
+int main()
+{
+    set_pca9547( 0 );
+
+    LM75B   tmp0( p28, p27 );   //  making instance after a branch of I2C bus (which is connecting the LM75B) enabled
+
+    while(1) {
+        printf( "%.3f\r\n", tmp0.read() );
+        wait( 1.0 );
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Jun 30 23:57:31 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/024bf7f99721
\ No newline at end of file