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.
Revision 5:8076127d0690, committed 2016-10-16
- Comitter:
- NT32
- Date:
- Sun Oct 16 06:40:13 2016 +0000
- Parent:
- 4:c5b0a318c84d
- Child:
- 6:517848b32b0f
- Commit message:
- ???????BMS??????
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Fri Apr 29 09:59:16 2016 +0000
+++ b/main.cpp Sun Oct 16 06:40:13 2016 +0000
@@ -96,18 +96,13 @@
dat[3] = 0xff;
dat[4] = 42;
dat[5] = 255;
-
- for(int loop = 0;loop < 6; loop++){
- spi.write(dat[loop]);
+ for(int loop_1 = 0; loop_1 < BMS_NUM; loop_1++){
+ for(int loop = 0;loop < 6; loop++){
+ spi.write(dat[loop]);
+ }
+ cmd = CalcCRCLTC6803(dat, 6);
+ spi.write(cmd);
}
- cmd = CalcCRCLTC6803(dat, 6);
- spi.write(cmd);
- for(int loop = 0;loop < 6; loop++){
- spi.write(dat[loop]);
- }
- cmd = CalcCRCLTC6803(dat, 6);
- spi.write(cmd);
-
cs = 1;
wait(0.001);
while(1) {
@@ -115,16 +110,12 @@
cmd = RDCV;
spi.write(cmd);
spi.write(CalcCRCLTC6803(&cmd, 1));
-
- for(int cell = 0;cell < 18; cell++){
- getdat[cell][0] = spi.write(0);
+ for(int bms = 0; bms < BMS_NUM; bms++){
+ for(int cell = 0;cell < 18; cell++){
+ getdat[cell][bms] = spi.write(0);
+ }
+ getpec = spi.write(0);
}
- getpec = spi.write(0);
- for(int cell = 0;cell < 18; cell++){
- getdat[cell][1] = spi.write(0);
- }
- getpec = spi.write(0);
-
cs = 1;
wait(0.001);
cs = 0;
@@ -146,13 +137,13 @@
cellvol[11][bms] = ((getdat[17][bms] << 4) | ((getdat[16][bms] & 0xf0) >> 4));
for(int loop = 0;loop < (12); loop++){
//表示する数値は(cellvol[loop] - 512)*1.5mV
- pc.printf("Cell%2d = %5dmV\n", (loop + (bms*12)) + 1, ((cellvol[loop][bms] - 512)+((cellvol[loop][bms] - 512)/2)));
+ pc.printf("Cell%2d = %5dmV\n", (loop) + (bms * 12) + 1, ((cellvol[loop][bms] - 512)+((cellvol[loop][bms] - 512)/2)));
cellallvol += cellvol[loop][bms];
}
}
pc.printf("CellALL = %5dmV\n", ((cellallvol - 512*(12 * BMS_NUM))+((cellallvol - 512*(12 * BMS_NUM))/2)));
- cmd = STCVADSELF1;
+ cmd = STCVADALL;
spi.write(cmd);
spi.write(CalcCRCLTC6803(&cmd, 1));