LPC1114FN28 I2C 24LC256 Test Program

Dependencies:   _24LCXXX mbed

Files at this revision

API Documentation at this revision

Comitter:
bant62
Date:
Fri Dec 06 10:01:40 2013 +0000
Commit message:
first commit

Changed in this revision

_24LCXXX.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
diff -r 000000000000 -r 1d290b4f8374 _24LCXXX.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/_24LCXXX.lib	Fri Dec 06 10:01:40 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/bant62/code/_24LCXXX/#859387a87312
diff -r 000000000000 -r 1d290b4f8374 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Dec 06 10:01:40 2013 +0000
@@ -0,0 +1,47 @@
+#include "mbed.h"
+#include "_24LCXXX.h"
+
+I2C i2c(dp5,dp27);        // sda, scl
+Serial pc(dp16, dp15); // tx, rx
+_24LCXXX eeprom(&i2c, 0x50);
+
+DigitalOut myled(LED1);
+
+int main() {
+    pc.baud(9600);
+    char data1;
+    int data2;
+    
+    pc.printf("memoroy byte data write!\n");
+    eeprom.byte_write(0, 1);
+    eeprom.byte_write(1, 2);
+    eeprom.byte_write(2, 3);
+    eeprom.byte_write(3, 4);
+    pc.printf("end\n");
+    
+    eeprom.nbyte_read( 0, &data1, 1 );
+    pc.printf("0:%02x ",data1);
+    eeprom.nbyte_read( 1, &data1, 1 );
+    pc.printf("1:%02x ",data1);
+    eeprom.nbyte_read( 2, &data1, 1 );
+    pc.printf("2:%02x ",data1);
+    eeprom.nbyte_read( 3, &data1, 1 );
+    pc.printf("3:%02x ",data1);
+    pc.printf("\nend\n");   
+    
+    pc.printf("memoroy int data write!\n");
+    data2 = 100;
+    eeprom.nbyte_write( 10, &data2, sizeof(int));
+    pc.printf("\nend\n");
+
+    eeprom.nbyte_read( 10, &data2, sizeof(int) );
+    pc.printf("int:%d ",data2);
+    pc.printf("\nend\n");
+
+    while(1) {
+        myled = 1;
+        wait(0.2);
+        myled = 0;
+        wait(0.2);
+    }
+}
diff -r 000000000000 -r 1d290b4f8374 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Fri Dec 06 10:01:40 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/a9913a65894f
\ No newline at end of file