Data send-receive by IIC-bus Hardware: IIC-board with 4 x PCF8574 IC you see a 8bit leds this leds show the value from an other 8574 who has 8 switches as input The 8xswitches from IIC you can see also at the pins PC_0 to PC_7

Dependencies:   mbed

Fork of Nucleo_IIC_2x8574in_out by Gerhard Neumaier

Gerhard Neumaier will show you : /media/uploads/schlaumaier54/funkturm.jpg

You can see my hardware: Nucleo F103RB with a IIC-bus application

In the background a printed board "IIC-Trainer" with different IIC ICs like PCF8574a, PCF8591, EEPROM; Real-time-clock In the foreground you see right a own-made printed circuit-board with 4x IC PCF8574


Eine Seite auf os_mbed ARM von Gerhard Neumaier Offenburg Feb 2018

Files at this revision

API Documentation at this revision

Fri Dec 15 11:25:59 2017 +0000
Commit message:
Version 15.Dez.17

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r b183e63b31f8 -r cb8a26c1d6e9 main.cpp
--- a/main.cpp	Fri Aug 21 11:40:23 2015 +0000
+++ b/main.cpp	Fri Dec 15 11:25:59 2017 +0000
@@ -9,7 +9,7 @@
 #include "mbed.h"
 #define PCF8574_ADDRoutput  0x46 // PCF8574 address 0x46 lowest bit (R/W)=0 IICboard P3
-#define PCF8574_ADDRinput   0x45 // PCF8574 address 0x44 lowest bit (R/W)=0 IICboard P2
+#define PCF8574_ADDRinput   0x45 // PCF8574 address 0x45 lowest bit (R/W)=1 IICboard P2
         //ADR-Jumper on IIC4xPCF8574board jumped to 0: Basis ADR:P0=0x40;P1=0x42;P2=0x44;P3=0x46;
        //ADR-Jumper on IIC4xPCF8574board jumped to 1: Basis ADR:P0=0x48;P1=0x4A;P2=0x4C;P3=0x4E; 
 #define LED_MASK  0xffff    //Portc has 16bit, therefore 4digit mask
@@ -27,14 +27,14 @@
 int main()
     char input8bit;
-    char data_write[2]; //must be char!!
-    char data_read[2]; //read buffer
+    char data_write[2]; //must be char!! a array with 2storage places
+    char data_read[2]; //read buffer   a array with 2storage places
     data_write[0] = 0xf2; //LEDs low aktiv  dummy
     int status = i2c.write(PCF8574_ADDRoutput , data_write, 1, 0);
-    if (status != 0) // Error  no acknowledge detected 
+    if (status != 0) // Error -> no acknowledge detected 
-        while (1) //-> endless loop when error no IIC-IC detected
+        while (1) //-> endless loop when error IIC detected
         myled = !myled;