電動バイク制御基板プログラム
Dependencies: BufferedSerial SDFileSystem mbed
Revision 2:1a62df057057, committed 2016-11-05
- Comitter:
- NT32
- Date:
- Sat Nov 05 10:16:21 2016 +0000
- Parent:
- 1:f61fbb8e4352
- Commit message:
- V850?????; rx->tx????
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r f61fbb8e4352 -r 1a62df057057 main.cpp --- a/main.cpp Sun Oct 16 13:40:09 2016 +0000 +++ b/main.cpp Sat Nov 05 10:16:21 2016 +0000 @@ -8,57 +8,70 @@ DigitalOut led1(P1_1); DigitalOut led2(P0_9); BusOut selUart(P1_5, P1_4); -Serial uart_cpld(P1_0, P0_31); +//Serial uart_cpld(P1_0, P0_31); //Serial uart_v850(P0_28, P0_29); //Serial uart_gps(P0_26, P0_27); -//Serial uart_handle(P0_0, P0_30); +//↓txをCPLDにして,rxをV850にする +Serial uart_handle(P0_0, P1_3); //<=(tx,rx)で,今は rx->tx と素通り //Serial uart_felica(P0_4, P0_2); -Serial uart_moni(P0_0,P0_30); +Serial pc(P0_18,P0_13); //SDFileSystem sd(P0_7, P0_5, P0_6, P0_8, "sd"); int main() { int cellVol[CELL_NUM] = {0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0}; int cellMinVol, cellMaxVol, cellAvgVol; + char buff[32]; + uart_handle.baud(38400); + // selUartがマルチプレクサのピン + selUart = SEL_HNDL; while(1) { + led1 = !led1; + uart_handle.scanf("%s", buff); + if(buff[0] == 's'){ +// pc.printf("\033[%d;%dH" ,0,0); //デバッグ用Tera Term出力 +// pc.printf("%s\n", buff); + uart_handle.printf("%s\n", buff); + } + //================================================= // バッテリ管理基板との通信 //================================================= - led1 = 0; - selUart = SEL_BMS; - uart_cpld.putc('s'); - for (int i = 0; i < CELL_NUM; ++i) - { - // 個別セル電圧取得 - uart_cpld.scanf("%d\n", &cellVol[i]); - } - //最低->最高->平均で取得 - uart_cpld.scanf("%d\n", &cellMinVol); - uart_cpld.scanf("%d\n", &cellMaxVol); - uart_cpld.scanf("%d\n", &cellAvgVol); - led1 = 1; +// led1 = 0; +// selUart = SEL_BMS; +// uart_cpld.putc('s'); +// for (int i = 0; i < CELL_NUM; ++i) +// { +// // 個別セル電圧取得 +// uart_cpld.scanf("%d\n", &cellVol[i]); +// } +// //最低->最高->平均で取得 +// uart_cpld.scanf("%d\n", &cellMinVol); +// uart_cpld.scanf("%d\n", &cellMaxVol); +// uart_cpld.scanf("%d\n", &cellAvgVol); +// led1 = 1; //================================================= // 表示装置との通信 //================================================= - led2 = 0; - selUart = SEL_HNDL; - uart_cpld.putc('m'); - uart_cpld.printf("\033[2J"); //デバッグ用Tera Term出力 - uart_cpld.printf("\033[%d;%dH" ,0,0); //デバッグ用Tera Term出力 - - wait(0.01); - for (int i = 0; i < CELL_NUM; ++i) - { - // 個別セル電圧取得 - uart_cpld.printf("%d\n",cellVol[i]); - } - //最低->最高->平均で取得 - uart_cpld.printf("%d\n",cellMinVol); - uart_cpld.printf("%d\n",cellMaxVol); - uart_cpld.printf("%d\n",cellAvgVol); - - led2 = 1; +// led2 = 0; +// selUart = SEL_HNDL; +// uart_cpld.putc('m'); +// uart_cpld.printf("\033[2J"); //デバッグ用Tera Term出力 +// uart_cpld.printf("\033[%d;%dH" ,0,0); //デバッグ用Tera Term出力 +// +// wait(0.01); +// for (int i = 0; i < CELL_NUM; ++i) +// { +// // 個別セル電圧取得 +// uart_cpld.printf("%d\n",cellVol[i]); +// } +// //最低->最高->平均で取得 +// uart_cpld.printf("%d\n",cellMinVol); +// uart_cpld.printf("%d\n",cellMaxVol); +// uart_cpld.printf("%d\n",cellAvgVol); +// +// led2 = 1; } }