EEPROM Multiplexer test
Dependencies: mbed EEPROM_lib
Diff: main.cpp
- Revision:
- 2:bd7fad3dc62e
- Parent:
- 1:de11b189ee57
diff -r de11b189ee57 -r bd7fad3dc62e main.cpp --- a/main.cpp Sun May 23 08:00:45 2021 +0000 +++ b/main.cpp Wed Jun 02 17:07:20 2021 +0000 @@ -27,6 +27,9 @@ int ptr, n = 0; int eeprom_ptr = 0; /* +// *************************************************** +**Write:buff_ptrとptrを混同してるからうまくいかないプログラム +// *************************************************** for(int ii = 0; ii < 2; ii ++){ pc.printf("Start to write %d EEPROM\r\n",ii); setEEPROMGroup(ii); @@ -47,7 +50,12 @@ } } */ - for(int i = 0; i < 2; i++){ + +// *************************************************** +// Write:buff_ptrとptrの混同問題を解決したあとのプログラム +// *************************************************** + + for(int i = 0; i < 4; i++){ pc.printf("Start to write %d EEPROM\r\n", i); setEEPROMGroup(i); EEPROM.setWriteAddr(1, 0, 0x00, 0x00); @@ -70,6 +78,9 @@ } } +// *************************************************** +// Read +// *************************************************** char data[128]; int num, block; @@ -80,7 +91,7 @@ //ADDR_H = ADDR_L = 0x00; //setEEPROMGroup(0); - for(int j = 0; j < 2; j ++){ + for(int j = 0; j < 4; j ++){ pc.printf("Start to read %d EEPROM\r\n",j); setEEPROMGroup(j); @@ -115,6 +126,11 @@ } } } + +// *************************************************** +// 入力した数字の文字列をint型として受け取る +// *************************************************** + /* while(1) { if(pc.readable()){ @@ -126,6 +142,9 @@ */ } +// *************************************************** +// マルチプレクサで使うEEPROMを変更する +// *************************************************** void setEEPROMGroup(int group_num){ switch(group_num){ case 0: