Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp@2:292423de1497, 2020-07-10 (annotated)
- Committer:
- rary
- Date:
- Fri Jul 10 15:25:02 2020 +0000
- Revision:
- 2:292423de1497
- Parent:
- 1:e5497e7c8c79
- Child:
- 3:7b7081d41c62
mulch EEPROM
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| rary | 0:f6e222782355 | 1 | #include "mbed.h" |
| rary | 0:f6e222782355 | 2 | #include "EEPROM.h" |
| rary | 0:f6e222782355 | 3 | |
| rary | 0:f6e222782355 | 4 | EEPROM rom(p9, p10); |
| rary | 0:f6e222782355 | 5 | Serial pc(USBTX, USBRX); |
| rary | 0:f6e222782355 | 6 | |
| rary | 0:f6e222782355 | 7 | int pointerAddress = 0; //EEPROM保存アドレス |
| rary | 0:f6e222782355 | 8 | |
| rary | 0:f6e222782355 | 9 | int main() |
| rary | 0:f6e222782355 | 10 | { |
| rary | 1:e5497e7c8c79 | 11 | char data_read[128]; |
| rary | 0:f6e222782355 | 12 | pc.baud(460800); //ボーレート変更 |
| rary | 2:292423de1497 | 13 | char ADDR; |
| rary | 0:f6e222782355 | 14 | |
| rary | 0:f6e222782355 | 15 | pc.printf("Start!"); |
| rary | 0:f6e222782355 | 16 | |
| rary | 2:292423de1497 | 17 | for(int i = 0;i <= 3000; i++) |
| rary | 0:f6e222782355 | 18 | { |
| rary | 2:292423de1497 | 19 | ADDR = rom.ref_ADDR(i); |
| rary | 1:e5497e7c8c79 | 20 | rom.write(ADDR, pointerAddress, '\0', 128); // write tha data |
| rary | 1:e5497e7c8c79 | 21 | pointerAddress = pointerAddress + 128; //アドレスずらし |
| rary | 0:f6e222782355 | 22 | } |
| rary | 0:f6e222782355 | 23 | |
| rary | 0:f6e222782355 | 24 | pointerAddress = 0; |
| rary | 0:f6e222782355 | 25 | pc.printf("Data read\r\n"); |
| rary | 0:f6e222782355 | 26 | |
| rary | 2:292423de1497 | 27 | for(int n = 0; n <= 3000; n++) |
| rary | 0:f6e222782355 | 28 | { |
| rary | 2:292423de1497 | 29 | ADDR = rom.ref_ADDR(n); |
| rary | 1:e5497e7c8c79 | 30 | rom.read(ADDR, pointerAddress, data_read, 128); |
| rary | 1:e5497e7c8c79 | 31 | wait_ms(5); |
| rary | 2:292423de1497 | 32 | pc.printf("%d,%s\r\n", n, data_read); |
| rary | 0:f6e222782355 | 33 | |
| rary | 1:e5497e7c8c79 | 34 | pointerAddress = pointerAddress + 128; //アドレスずらし |
| rary | 1:e5497e7c8c79 | 35 | memset(data_read, '\0', 128 ); //初期化 |
| rary | 0:f6e222782355 | 36 | } |
| rary | 0:f6e222782355 | 37 | pc.printf("Finish!\r\n"); |
| rary | 0:f6e222782355 | 38 | } |