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.
Dependencies: mbed
Fork of DataLoggerRS232trial by
Revision 2:6ebf09171de9, committed 2016-09-18
- Comitter:
- Dengjj
- Date:
- Sun Sep 18 05:45:40 2016 +0000
- Parent:
- 1:875d121e9ce9
- Commit message:
- read biao power summary
Changed in this revision
| DataLoggerRS232/DataLoggerRS232.cpp | Show annotated file Show diff for this revision Revisions of this file |
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/DataLoggerRS232/DataLoggerRS232.cpp Wed Sep 14 10:32:49 2016 +0000
+++ b/DataLoggerRS232/DataLoggerRS232.cpp Sun Sep 18 05:45:40 2016 +0000
@@ -43,7 +43,7 @@
else
rDisplay++;
}
- printf("display_ECU_databyte !!\r\n");
+ //printf("display_ECU_databyte !!\r\n");
}
--- a/main.cpp Wed Sep 14 10:32:49 2016 +0000
+++ b/main.cpp Sun Sep 18 05:45:40 2016 +0000
@@ -2,43 +2,58 @@
#include "DataLoggerRS232.h"
Serial pc (USBTX, USBRX); // tx, rx
-DataLoggerRS232 dataLogger (PA_2,PA_3); // tx, rx
+Serial dataLogger (PA_2,PA_3); // tx, rx
-char DLcommand;
+//char DLcommand;
+int abc[]={104,87,36,19,0,0,0,104,17,4,51,51,51,51,63,22};
+
char DLcommand2;
int main() {
pc.baud(115200);
pc.printf("PC and Datalogger serial set up complete !!\n\r");
- dataLogger.baud(9600);
+ dataLogger.baud(2400);
+ dataLogger.format(9,SerialBase::Even,1);
pc.printf("Here !!\n\r");
-
+ int i;
+ const int m=16;
while(1) {
- if(pc.readable()) {
+ i=0;
+// if(pc.readable()) {
+ if(dataLogger.writeable()){
+ for(i=0;i<m;i++){
+ dataLogger.putc(abc[i]);
+ }
+ pc.printf("T");
+ // dataLogger.printf("%c",DLcommand);
+// dataLogger.count = 0;
+// DLcommand = pc.getc();
+// pc.printf("\n\r%c\n\r",DLcommand);
- dataLogger.count = 0;
- DLcommand = pc.getc();
- pc.printf("\n\r%c\n\r",DLcommand);
-
- dataLogger.putc(DLcommand);
- dataLogger.get_ECU_databyte();
+// dataLogger.putc(DLcommand);
+// dataLogger.get_ECU_databyte();
}
- //dataLogger.display_ECU_databyte();
- wait(2);
+// dataLogger.display_ECU_databyte();
+// wait(4);
//-----------------------------------------------
- if(dataLogger.readable()) {
+ if(dataLogger.readable()) {
+ pc.printf("R");
+ char DLcommand[25];
+// dataLogger.count = 0;
+for(i=0;i<25;i++){
+ DLcommand[i]= dataLogger.getc();
+ pc.putc(DLcommand[i]);
+ }
+ // DLcommand = dataLogger.getc();
+// DLcommand2 = dataLogger.getc();
+
+ ;
+// pc.printf("\n\r%c\n\r",DLcommand2);
+ // dataLogger.putc(DLcommand);
+// dataLogger.get_ECU_databyte();
+ }
+// dataLogger.display_ECU_databyte();
+
+ wait(4);
- dataLogger.count = 0;
- DLcommand = dataLogger.getc();
- DLcommand2 = dataLogger.getc();
- pc.printf("\n\r%c\n\r",DLcommand);
- pc.printf("\n\r%c\n\r",DLcommand2);
- dataLogger.putc(DLcommand);
- dataLogger.get_ECU_databyte();
- }
- dataLogger.display_ECU_databyte();
-
- wait(2);
-
- }
-}
\ No newline at end of file
+ }}
