EEPROM Multiplexer test
Dependencies: mbed EEPROM_lib
Diff: main.cpp
- Revision:
- 1:de11b189ee57
- Parent:
- 0:659448bed797
- Child:
- 2:bd7fad3dc62e
diff -r 659448bed797 -r de11b189ee57 main.cpp --- a/main.cpp Sun May 23 06:46:00 2021 +0000 +++ b/main.cpp Sun May 23 08:00:45 2021 +0000 @@ -12,6 +12,8 @@ int main() { + pc.printf("Please Input '7' to Start Progeam\r\n"); + while(1) { if(pc.readable()){ int c = pc.getc(); @@ -23,6 +25,8 @@ } int ptr, n = 0; + int eeprom_ptr = 0; + /* for(int ii = 0; ii < 2; ii ++){ pc.printf("Start to write %d EEPROM\r\n",ii); setEEPROMGroup(ii); @@ -42,6 +46,29 @@ } } } + */ + for(int i = 0; i < 2; i++){ + pc.printf("Start to write %d EEPROM\r\n", i); + setEEPROMGroup(i); + EEPROM.setWriteAddr(1, 0, 0x00, 0x00); + + while(1){ + ptr = EEPROM.chargeBuff((int)n++); + //ptr = EEPROM.chargeBuff((char)0xff); + if(ptr == 128){ + EEPROM.writeBuff(); + //ptr = EEPROM.setNextPage(); + eeprom_ptr = EEPROM.setNextPage(); + //pc.printf("eeprom_ptr: %08x\r\n", eeprom_ptr); + } + + if(eeprom_ptr == 0x01000000){ + ptr = 0; + eeprom_ptr = 0; + break; + } + } + } char data[128]; @@ -49,14 +76,17 @@ char ADDR_H, ADDR_L; num = 1; - block = 0; - ADDR_H = ADDR_L = 0x00; + //block = 0; + //ADDR_H = ADDR_L = 0x00; - setEEPROMGroup(0); - + //setEEPROMGroup(0); for(int j = 0; j < 2; j ++){ pc.printf("Start to read %d EEPROM\r\n",j); + setEEPROMGroup(j); + block = 0; + ADDR_H = ADDR_L = 0x00; + for(int i = 0; i < 1024; i ++){ switch(i){ case 512: