obd + elm327 + lcd1602

Dependencies:   mbed TextLCD

Committer:
Marcelocostanzo
Date:
Thu Jun 04 14:37:47 2020 +0000
Revision:
2:17d61cc5f0c0
Parent:
1:7fa61b250083
leitor obd com elm327 e lcd1602

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Marcelocostanzo 0:81f7d0ea45b6 1 #include "mbed.h"
Marcelocostanzo 0:81f7d0ea45b6 2 #include "codes.h"
Marcelocostanzo 2:17d61cc5f0c0 3 #include "TextLCD.h"
Marcelocostanzo 2:17d61cc5f0c0 4
Marcelocostanzo 2:17d61cc5f0c0 5 TextLCD lcd(D8, D9, D4, D5, D6, D7); // rs, e, d4-d7
Marcelocostanzo 2:17d61cc5f0c0 6
Marcelocostanzo 0:81f7d0ea45b6 7 DigitalOut myled(LED1);
Marcelocostanzo 0:81f7d0ea45b6 8
Marcelocostanzo 1:7fa61b250083 9 //Serial pc(USBTX,USBRX);
Marcelocostanzo 0:81f7d0ea45b6 10
Marcelocostanzo 0:81f7d0ea45b6 11 Serial device(PA_11, PA_12);
Marcelocostanzo 0:81f7d0ea45b6 12
Marcelocostanzo 2:17d61cc5f0c0 13 AnalogIn BUTTON_ADC(A0);
Marcelocostanzo 2:17d61cc5f0c0 14
Marcelocostanzo 0:81f7d0ea45b6 15 Ticker flipper;
Marcelocostanzo 0:81f7d0ea45b6 16
Marcelocostanzo 0:81f7d0ea45b6 17
Marcelocostanzo 0:81f7d0ea45b6 18 void flip(void);
Marcelocostanzo 0:81f7d0ea45b6 19 void OBDInit(void);
Marcelocostanzo 0:81f7d0ea45b6 20 void read_serial(void);
Marcelocostanzo 0:81f7d0ea45b6 21
Marcelocostanzo 0:81f7d0ea45b6 22 void ask_intake_pressure_absolute(void);
Marcelocostanzo 2:17d61cc5f0c0 23 void ask_engine_coolant_temperature(void);
Marcelocostanzo 0:81f7d0ea45b6 24 void ask_engine_rpm(void);
Marcelocostanzo 0:81f7d0ea45b6 25 void ask_vehile_speed(void);
Marcelocostanzo 0:81f7d0ea45b6 26 void ask_intake_air_temperature(void);
Marcelocostanzo 0:81f7d0ea45b6 27 void ask_throttle_position(void);
Marcelocostanzo 0:81f7d0ea45b6 28 void ask_oxygen_sensor(void);
Marcelocostanzo 0:81f7d0ea45b6 29 void ask_fuel_rail_pressure(void);
Marcelocostanzo 0:81f7d0ea45b6 30
Marcelocostanzo 0:81f7d0ea45b6 31 char RESPONSE_INTAKE_PRESSURE_ABSOLUTE[64];
Marcelocostanzo 2:17d61cc5f0c0 32 char RESPONSE_ENGINE_COOLANT_TEMPERATURE[64];
Marcelocostanzo 0:81f7d0ea45b6 33 char RESPONSE_ENGINE_RPM[64];
Marcelocostanzo 0:81f7d0ea45b6 34 char RESPONSE_VEHILE_SPEED[64];
Marcelocostanzo 0:81f7d0ea45b6 35 char RESPONSE_INTAKE_AIR_TEMPERATURE[64];
Marcelocostanzo 0:81f7d0ea45b6 36 char RESPONSE_THROTTLE_POSITION[64];
Marcelocostanzo 0:81f7d0ea45b6 37 char RESPONSE_OXYGEN_SENSOR[64];
Marcelocostanzo 0:81f7d0ea45b6 38 char RESPONSE_FUEL_RAIL_PRESSURE[64];
Marcelocostanzo 0:81f7d0ea45b6 39
Marcelocostanzo 0:81f7d0ea45b6 40 char c[64];
Marcelocostanzo 0:81f7d0ea45b6 41
Marcelocostanzo 0:81f7d0ea45b6 42 float INTAKE_PRESSURE_ABSOLUTE;
Marcelocostanzo 0:81f7d0ea45b6 43 int ENGINE_RPM;
Marcelocostanzo 0:81f7d0ea45b6 44 int VEHILE_SPEED;
Marcelocostanzo 0:81f7d0ea45b6 45 int INTAKE_AIR_TEMPERATURE;
Marcelocostanzo 2:17d61cc5f0c0 46 int ENGINE_COOLANT_TEMPERATURE;
Marcelocostanzo 0:81f7d0ea45b6 47 float THROTTLE_POSITION;
Marcelocostanzo 0:81f7d0ea45b6 48 float SHORT_TERM_FUEL_TRIM;
Marcelocostanzo 0:81f7d0ea45b6 49 float OXYGEN_SENSOR;
Marcelocostanzo 0:81f7d0ea45b6 50 float FUEL_RAIL_PRESSURE;
Marcelocostanzo 0:81f7d0ea45b6 51
Marcelocostanzo 0:81f7d0ea45b6 52 int main()
Marcelocostanzo 0:81f7d0ea45b6 53 {
Marcelocostanzo 0:81f7d0ea45b6 54 flipper.attach(&flip, 1.0);
Marcelocostanzo 1:7fa61b250083 55 //pc.baud(115200);
Marcelocostanzo 2:17d61cc5f0c0 56
Marcelocostanzo 2:17d61cc5f0c0 57 lcd.setCursor(TextLCD::CurOff_BlkOff);
Marcelocostanzo 2:17d61cc5f0c0 58 lcd.locate (0,0);
Marcelocostanzo 2:17d61cc5f0c0 59 lcd.printf ("Starting up");
Marcelocostanzo 0:81f7d0ea45b6 60
Marcelocostanzo 1:7fa61b250083 61 //pc.printf("OBD STM32 v1.1.002");
Marcelocostanzo 1:7fa61b250083 62 //pc.printf("\r\n");
Marcelocostanzo 0:81f7d0ea45b6 63
Marcelocostanzo 1:7fa61b250083 64 device.baud(57600);
Marcelocostanzo 0:81f7d0ea45b6 65 OBDInit();
Marcelocostanzo 0:81f7d0ea45b6 66
Marcelocostanzo 1:7fa61b250083 67 //pc.printf("OBD Inicializado");
Marcelocostanzo 1:7fa61b250083 68 //pc.printf("\r\n");
Marcelocostanzo 0:81f7d0ea45b6 69
Marcelocostanzo 0:81f7d0ea45b6 70 lcd.cls();
Marcelocostanzo 2:17d61cc5f0c0 71 lcd.locate(0,0);
Marcelocostanzo 0:81f7d0ea45b6 72 lcd.printf("OBD Inicializado");
Marcelocostanzo 0:81f7d0ea45b6 73
Marcelocostanzo 0:81f7d0ea45b6 74 wait_ms(1500);
Marcelocostanzo 0:81f7d0ea45b6 75 lcd.cls();
Marcelocostanzo 0:81f7d0ea45b6 76
Marcelocostanzo 2:17d61cc5f0c0 77 int FREQ = 1000;
Marcelocostanzo 2:17d61cc5f0c0 78 int BUTTON;
Marcelocostanzo 0:81f7d0ea45b6 79
Marcelocostanzo 0:81f7d0ea45b6 80 while(1)
Marcelocostanzo 0:81f7d0ea45b6 81 {
Marcelocostanzo 2:17d61cc5f0c0 82 if ((BUTTON_ADC * 3.3) < 3.10) BUTTON = 4; //pc.printf("SELECT\n\r");
Marcelocostanzo 2:17d61cc5f0c0 83 if ((BUTTON_ADC * 3.3) < 1.95) BUTTON = 3; //pc.printf("LEFT\n\r");
Marcelocostanzo 2:17d61cc5f0c0 84 if ((BUTTON_ADC * 3.3) < 1.23) BUTTON = 2; //pc.printf("DOWN\n\r");
Marcelocostanzo 2:17d61cc5f0c0 85 if ((BUTTON_ADC * 3.3) < 0.50) BUTTON = 1; //pc.printf("UP\n\r");
Marcelocostanzo 2:17d61cc5f0c0 86 if ((BUTTON_ADC * 3.3) < 0.20) BUTTON = 0; //pc.printf("RIGHT\n\r");
Marcelocostanzo 1:7fa61b250083 87
Marcelocostanzo 2:17d61cc5f0c0 88 if(BUTTON == 0)
Marcelocostanzo 2:17d61cc5f0c0 89 {
Marcelocostanzo 2:17d61cc5f0c0 90 lcd.cls();
Marcelocostanzo 2:17d61cc5f0c0 91 ask_engine_rpm();
Marcelocostanzo 2:17d61cc5f0c0 92 lcd.locate(0,0);
Marcelocostanzo 2:17d61cc5f0c0 93 lcd.printf("%04i RPM",ENGINE_RPM);
Marcelocostanzo 2:17d61cc5f0c0 94 wait_ms(FREQ);
Marcelocostanzo 0:81f7d0ea45b6 95
Marcelocostanzo 2:17d61cc5f0c0 96 ask_engine_coolant_temperature();
Marcelocostanzo 2:17d61cc5f0c0 97 lcd.locate(1,0);
Marcelocostanzo 2:17d61cc5f0c0 98 lcd.printf("%04i C",ENGINE_COOLANT_TEMPERATURE);
Marcelocostanzo 2:17d61cc5f0c0 99 wait_ms(FREQ);
Marcelocostanzo 2:17d61cc5f0c0 100 }
Marcelocostanzo 1:7fa61b250083 101
Marcelocostanzo 2:17d61cc5f0c0 102 if(BUTTON == 1)
Marcelocostanzo 2:17d61cc5f0c0 103 {
Marcelocostanzo 2:17d61cc5f0c0 104 lcd.cls();
Marcelocostanzo 2:17d61cc5f0c0 105 ask_intake_pressure_absolute();
Marcelocostanzo 2:17d61cc5f0c0 106 lcd.locate(0,0);
Marcelocostanzo 2:17d61cc5f0c0 107 lcd.printf("%+03.2f bar",INTAKE_PRESSURE_ABSOLUTE);
Marcelocostanzo 2:17d61cc5f0c0 108 wait_ms(FREQ);
Marcelocostanzo 1:7fa61b250083 109
Marcelocostanzo 2:17d61cc5f0c0 110 ask_vehile_speed();
Marcelocostanzo 2:17d61cc5f0c0 111 lcd.locate(1,0);
Marcelocostanzo 2:17d61cc5f0c0 112 lcd.printf("%03i Km/h",VEHILE_SPEED);
Marcelocostanzo 2:17d61cc5f0c0 113 wait_ms(FREQ);
Marcelocostanzo 2:17d61cc5f0c0 114 }
Marcelocostanzo 1:7fa61b250083 115
Marcelocostanzo 2:17d61cc5f0c0 116 if(BUTTON == 2)
Marcelocostanzo 2:17d61cc5f0c0 117 {
Marcelocostanzo 2:17d61cc5f0c0 118 lcd.cls();
Marcelocostanzo 2:17d61cc5f0c0 119 ask_intake_air_temperature();
Marcelocostanzo 2:17d61cc5f0c0 120 lcd.locate(0,0);
Marcelocostanzo 2:17d61cc5f0c0 121 lcd.printf("%03i C",INTAKE_AIR_TEMPERATURE);
Marcelocostanzo 2:17d61cc5f0c0 122 wait_ms(FREQ);
Marcelocostanzo 1:7fa61b250083 123
Marcelocostanzo 2:17d61cc5f0c0 124 ask_throttle_position();
Marcelocostanzo 2:17d61cc5f0c0 125 lcd.locate(1,0);
Marcelocostanzo 2:17d61cc5f0c0 126 lcd.printf("%05.2f pc",THROTTLE_POSITION);
Marcelocostanzo 2:17d61cc5f0c0 127 wait_ms(FREQ);
Marcelocostanzo 2:17d61cc5f0c0 128 }
Marcelocostanzo 0:81f7d0ea45b6 129
Marcelocostanzo 2:17d61cc5f0c0 130 if(BUTTON == 3)
Marcelocostanzo 2:17d61cc5f0c0 131 {
Marcelocostanzo 2:17d61cc5f0c0 132 lcd.cls();
Marcelocostanzo 2:17d61cc5f0c0 133 ask_oxygen_sensor();
Marcelocostanzo 2:17d61cc5f0c0 134 lcd.locate(0,0);
Marcelocostanzo 2:17d61cc5f0c0 135 lcd.printf("%04.3f mV",OXYGEN_SENSOR);
Marcelocostanzo 2:17d61cc5f0c0 136 wait_ms(FREQ);
Marcelocostanzo 0:81f7d0ea45b6 137
Marcelocostanzo 2:17d61cc5f0c0 138 ask_fuel_rail_pressure();
Marcelocostanzo 2:17d61cc5f0c0 139 lcd.locate(1,0);
Marcelocostanzo 2:17d61cc5f0c0 140 lcd.printf("%06.2f bar",FUEL_RAIL_PRESSURE);
Marcelocostanzo 2:17d61cc5f0c0 141 wait_ms(FREQ);
Marcelocostanzo 2:17d61cc5f0c0 142 }
Marcelocostanzo 0:81f7d0ea45b6 143 }
Marcelocostanzo 0:81f7d0ea45b6 144 }
Marcelocostanzo 0:81f7d0ea45b6 145
Marcelocostanzo 0:81f7d0ea45b6 146 void flip()
Marcelocostanzo 0:81f7d0ea45b6 147 {
Marcelocostanzo 0:81f7d0ea45b6 148 myled = !myled;
Marcelocostanzo 0:81f7d0ea45b6 149 }
Marcelocostanzo 0:81f7d0ea45b6 150
Marcelocostanzo 0:81f7d0ea45b6 151 void ask_intake_pressure_absolute()
Marcelocostanzo 0:81f7d0ea45b6 152 {
Marcelocostanzo 0:81f7d0ea45b6 153 int i = 0;
Marcelocostanzo 0:81f7d0ea45b6 154
Marcelocostanzo 0:81f7d0ea45b6 155 device.printf(PID_INTAKE_PRESSURE_ABSOLUTE);
Marcelocostanzo 0:81f7d0ea45b6 156 device.printf(CR);
Marcelocostanzo 0:81f7d0ea45b6 157 while(!device.readable()){} //fica esperando chegar algo na serial
Marcelocostanzo 0:81f7d0ea45b6 158 while(RESPONSE_INTAKE_PRESSURE_ABSOLUTE[i-1]!= '\r') //chegou algo! vamos ler até o CR
Marcelocostanzo 0:81f7d0ea45b6 159 {
Marcelocostanzo 0:81f7d0ea45b6 160 RESPONSE_INTAKE_PRESSURE_ABSOLUTE[i] = device.getc();
Marcelocostanzo 0:81f7d0ea45b6 161 i++;
Marcelocostanzo 0:81f7d0ea45b6 162 }
Marcelocostanzo 0:81f7d0ea45b6 163
Marcelocostanzo 0:81f7d0ea45b6 164 char DATA_A[2];
Marcelocostanzo 0:81f7d0ea45b6 165 char DATA_B[2];
Marcelocostanzo 0:81f7d0ea45b6 166 char DATA_C[2];
Marcelocostanzo 0:81f7d0ea45b6 167 char DATA_D[2];
Marcelocostanzo 0:81f7d0ea45b6 168
Marcelocostanzo 0:81f7d0ea45b6 169 DATA_A[0] = RESPONSE_INTAKE_PRESSURE_ABSOLUTE[i-3];
Marcelocostanzo 0:81f7d0ea45b6 170 DATA_A[1] = RESPONSE_INTAKE_PRESSURE_ABSOLUTE[i-2];
Marcelocostanzo 0:81f7d0ea45b6 171
Marcelocostanzo 0:81f7d0ea45b6 172 int VAL_A = strtol(DATA_A,NULL,16);
Marcelocostanzo 0:81f7d0ea45b6 173
Marcelocostanzo 0:81f7d0ea45b6 174 //pc.printf("%i\r",VAL_A);
Marcelocostanzo 0:81f7d0ea45b6 175
Marcelocostanzo 0:81f7d0ea45b6 176 INTAKE_PRESSURE_ABSOLUTE = (VAL_A * 0.01f) - 1.0f;
Marcelocostanzo 0:81f7d0ea45b6 177
Marcelocostanzo 1:7fa61b250083 178 //pc.printf("pressao %i\r",INTAKE_AIR_TEMPERATURE);
Marcelocostanzo 0:81f7d0ea45b6 179
Marcelocostanzo 1:7fa61b250083 180 //for(int j = 0; j < i; j++)
Marcelocostanzo 1:7fa61b250083 181 //{
Marcelocostanzo 1:7fa61b250083 182 //pc.printf("%c",RESPONSE_INTAKE_PRESSURE_ABSOLUTE[j]);
Marcelocostanzo 1:7fa61b250083 183 //}
Marcelocostanzo 0:81f7d0ea45b6 184 }
Marcelocostanzo 0:81f7d0ea45b6 185
Marcelocostanzo 0:81f7d0ea45b6 186 void ask_engine_rpm()
Marcelocostanzo 0:81f7d0ea45b6 187 {
Marcelocostanzo 0:81f7d0ea45b6 188 int i = 0;
Marcelocostanzo 0:81f7d0ea45b6 189
Marcelocostanzo 0:81f7d0ea45b6 190 device.printf(PID_ENGINE_RPM);
Marcelocostanzo 0:81f7d0ea45b6 191 device.printf(CR);
Marcelocostanzo 0:81f7d0ea45b6 192 while(!device.readable()){} //fica esperando chegar algo na serial
Marcelocostanzo 0:81f7d0ea45b6 193 while(RESPONSE_ENGINE_RPM[i-1]!= '\r') //chegou algo! vamos ler até o CR
Marcelocostanzo 0:81f7d0ea45b6 194 {
Marcelocostanzo 0:81f7d0ea45b6 195 RESPONSE_ENGINE_RPM[i] = device.getc();
Marcelocostanzo 0:81f7d0ea45b6 196 i++;
Marcelocostanzo 0:81f7d0ea45b6 197 }
Marcelocostanzo 0:81f7d0ea45b6 198
Marcelocostanzo 0:81f7d0ea45b6 199 char DATA_A[2];
Marcelocostanzo 0:81f7d0ea45b6 200 char DATA_B[2];
Marcelocostanzo 0:81f7d0ea45b6 201 char DATA_C[2];
Marcelocostanzo 0:81f7d0ea45b6 202 char DATA_D[2];
Marcelocostanzo 0:81f7d0ea45b6 203
Marcelocostanzo 0:81f7d0ea45b6 204 DATA_A[0] = RESPONSE_ENGINE_RPM[i-5];
Marcelocostanzo 0:81f7d0ea45b6 205 DATA_A[1] = RESPONSE_ENGINE_RPM[i-4];
Marcelocostanzo 0:81f7d0ea45b6 206
Marcelocostanzo 0:81f7d0ea45b6 207 DATA_B[0] = RESPONSE_ENGINE_RPM[i-3];
Marcelocostanzo 0:81f7d0ea45b6 208 DATA_B[1] = RESPONSE_ENGINE_RPM[i-2];
Marcelocostanzo 0:81f7d0ea45b6 209
Marcelocostanzo 0:81f7d0ea45b6 210 int VAL_A = strtol(DATA_A,NULL,16);
Marcelocostanzo 0:81f7d0ea45b6 211 int VAL_B = strtol(DATA_B,NULL,16);
Marcelocostanzo 0:81f7d0ea45b6 212
Marcelocostanzo 0:81f7d0ea45b6 213 //pc.printf("%i\r",VAL_A);
Marcelocostanzo 0:81f7d0ea45b6 214 //pc.printf("%i\r",VAL_B);
Marcelocostanzo 0:81f7d0ea45b6 215
Marcelocostanzo 0:81f7d0ea45b6 216 ENGINE_RPM = ((VAL_A * 256) + VAL_B) / 4;
Marcelocostanzo 0:81f7d0ea45b6 217
Marcelocostanzo 1:7fa61b250083 218 //pc.printf("rpm %i\r",ENGINE_RPM);
Marcelocostanzo 0:81f7d0ea45b6 219
Marcelocostanzo 1:7fa61b250083 220 //for(int j = 0; j < i; j++)
Marcelocostanzo 1:7fa61b250083 221 //{
Marcelocostanzo 1:7fa61b250083 222 //pc.printf("%c",RESPONSE_ENGINE_RPM[j]);
Marcelocostanzo 1:7fa61b250083 223 //}
Marcelocostanzo 0:81f7d0ea45b6 224 }
Marcelocostanzo 0:81f7d0ea45b6 225
Marcelocostanzo 0:81f7d0ea45b6 226 void ask_vehile_speed()
Marcelocostanzo 0:81f7d0ea45b6 227 {
Marcelocostanzo 0:81f7d0ea45b6 228 int i = 0;
Marcelocostanzo 0:81f7d0ea45b6 229
Marcelocostanzo 0:81f7d0ea45b6 230 device.printf(PID_VEHILE_SPEED);
Marcelocostanzo 0:81f7d0ea45b6 231 device.printf(CR);
Marcelocostanzo 0:81f7d0ea45b6 232 while(!device.readable()){} //fica esperando chegar algo na serial
Marcelocostanzo 2:17d61cc5f0c0 233 while(RESPONSE_VEHILE_SPEED[i-1]!= '\r') //chegou algo! vamos ler até o CR
Marcelocostanzo 0:81f7d0ea45b6 234 {
Marcelocostanzo 0:81f7d0ea45b6 235 RESPONSE_VEHILE_SPEED[i] = device.getc();
Marcelocostanzo 0:81f7d0ea45b6 236 i++;
Marcelocostanzo 0:81f7d0ea45b6 237 }
Marcelocostanzo 0:81f7d0ea45b6 238
Marcelocostanzo 0:81f7d0ea45b6 239 char DATA_A[2];
Marcelocostanzo 0:81f7d0ea45b6 240 char DATA_B[2];
Marcelocostanzo 0:81f7d0ea45b6 241 char DATA_C[2];
Marcelocostanzo 0:81f7d0ea45b6 242 char DATA_D[2];
Marcelocostanzo 0:81f7d0ea45b6 243
Marcelocostanzo 0:81f7d0ea45b6 244 DATA_A[0] = RESPONSE_VEHILE_SPEED[i-3];
Marcelocostanzo 0:81f7d0ea45b6 245 DATA_A[1] = RESPONSE_VEHILE_SPEED[i-2];
Marcelocostanzo 0:81f7d0ea45b6 246
Marcelocostanzo 0:81f7d0ea45b6 247 int VAL_A = strtol(DATA_A,NULL,16);
Marcelocostanzo 0:81f7d0ea45b6 248
Marcelocostanzo 0:81f7d0ea45b6 249 //pc.printf("%i\r",VAL_A);
Marcelocostanzo 0:81f7d0ea45b6 250
Marcelocostanzo 0:81f7d0ea45b6 251 VEHILE_SPEED = VAL_A;
Marcelocostanzo 0:81f7d0ea45b6 252
Marcelocostanzo 1:7fa61b250083 253 //pc.printf("%i kmh\r",VEHILE_SPEED);
Marcelocostanzo 0:81f7d0ea45b6 254
Marcelocostanzo 1:7fa61b250083 255 //for(int j = 0; j < i; j++)
Marcelocostanzo 1:7fa61b250083 256 //{
Marcelocostanzo 1:7fa61b250083 257 //pc.printf("%c",RESPONSE_VEHILE_SPEED[j]);
Marcelocostanzo 1:7fa61b250083 258 //}
Marcelocostanzo 0:81f7d0ea45b6 259 }
Marcelocostanzo 0:81f7d0ea45b6 260
Marcelocostanzo 0:81f7d0ea45b6 261 void ask_intake_air_temperature()
Marcelocostanzo 0:81f7d0ea45b6 262 {
Marcelocostanzo 0:81f7d0ea45b6 263 int i = 0;
Marcelocostanzo 0:81f7d0ea45b6 264
Marcelocostanzo 0:81f7d0ea45b6 265 device.printf(PID_INTAKE_AIR_TEMPERATURE);
Marcelocostanzo 0:81f7d0ea45b6 266 device.printf(CR);
Marcelocostanzo 0:81f7d0ea45b6 267 while(!device.readable()){} //fica esperando chegar algo na serial
Marcelocostanzo 0:81f7d0ea45b6 268 while(RESPONSE_INTAKE_AIR_TEMPERATURE[i-1]!= '\r') //chegou algo! vamos ler até o CR
Marcelocostanzo 0:81f7d0ea45b6 269 {
Marcelocostanzo 0:81f7d0ea45b6 270 RESPONSE_INTAKE_AIR_TEMPERATURE[i] = device.getc();
Marcelocostanzo 0:81f7d0ea45b6 271 i++;
Marcelocostanzo 0:81f7d0ea45b6 272 }
Marcelocostanzo 0:81f7d0ea45b6 273
Marcelocostanzo 0:81f7d0ea45b6 274 char DATA_A[2];
Marcelocostanzo 0:81f7d0ea45b6 275 char DATA_B[2];
Marcelocostanzo 0:81f7d0ea45b6 276 char DATA_C[2];
Marcelocostanzo 0:81f7d0ea45b6 277 char DATA_D[2];
Marcelocostanzo 0:81f7d0ea45b6 278
Marcelocostanzo 0:81f7d0ea45b6 279 DATA_A[0] = RESPONSE_INTAKE_AIR_TEMPERATURE[i-3];
Marcelocostanzo 0:81f7d0ea45b6 280 DATA_A[1] = RESPONSE_INTAKE_AIR_TEMPERATURE[i-2];
Marcelocostanzo 0:81f7d0ea45b6 281
Marcelocostanzo 0:81f7d0ea45b6 282 int VAL_A = strtol(DATA_A,NULL,16);
Marcelocostanzo 0:81f7d0ea45b6 283
Marcelocostanzo 0:81f7d0ea45b6 284 //pc.printf("%i\r",VAL_A);
Marcelocostanzo 0:81f7d0ea45b6 285
Marcelocostanzo 2:17d61cc5f0c0 286 INTAKE_AIR_TEMPERATURE = VAL_A - 40;
Marcelocostanzo 2:17d61cc5f0c0 287
Marcelocostanzo 2:17d61cc5f0c0 288 //pc.printf("temp ar %i\r",INTAKE_AIR_TEMPERATURE);
Marcelocostanzo 2:17d61cc5f0c0 289
Marcelocostanzo 2:17d61cc5f0c0 290 //for(int j = 0; j < i; j++)
Marcelocostanzo 2:17d61cc5f0c0 291 //{
Marcelocostanzo 2:17d61cc5f0c0 292 //pc.printf("%c",RESPONSE_INTAKE_AIR_TEMPERATURE[j]);
Marcelocostanzo 2:17d61cc5f0c0 293 //}
Marcelocostanzo 2:17d61cc5f0c0 294 }
Marcelocostanzo 2:17d61cc5f0c0 295
Marcelocostanzo 2:17d61cc5f0c0 296 void ask_engine_coolant_temperature()
Marcelocostanzo 2:17d61cc5f0c0 297 {
Marcelocostanzo 2:17d61cc5f0c0 298 int i = 0;
Marcelocostanzo 2:17d61cc5f0c0 299
Marcelocostanzo 2:17d61cc5f0c0 300 device.printf(PID_ENGINE_COOLANT_TEMPERATURE);
Marcelocostanzo 2:17d61cc5f0c0 301 device.printf(CR);
Marcelocostanzo 2:17d61cc5f0c0 302 while(!device.readable()){} //fica esperando chegar algo na serial
Marcelocostanzo 2:17d61cc5f0c0 303 while(RESPONSE_ENGINE_COOLANT_TEMPERATURE[i-1]!= '\r') //chegou algo! vamos ler até o CR
Marcelocostanzo 2:17d61cc5f0c0 304 {
Marcelocostanzo 2:17d61cc5f0c0 305 RESPONSE_ENGINE_COOLANT_TEMPERATURE[i] = device.getc();
Marcelocostanzo 2:17d61cc5f0c0 306 i++;
Marcelocostanzo 2:17d61cc5f0c0 307 }
Marcelocostanzo 2:17d61cc5f0c0 308
Marcelocostanzo 2:17d61cc5f0c0 309 char DATA_A[2];
Marcelocostanzo 2:17d61cc5f0c0 310 char DATA_B[2];
Marcelocostanzo 2:17d61cc5f0c0 311 char DATA_C[2];
Marcelocostanzo 2:17d61cc5f0c0 312 char DATA_D[2];
Marcelocostanzo 2:17d61cc5f0c0 313
Marcelocostanzo 2:17d61cc5f0c0 314 DATA_A[0] = RESPONSE_ENGINE_COOLANT_TEMPERATURE[i-3];
Marcelocostanzo 2:17d61cc5f0c0 315 DATA_A[1] = RESPONSE_ENGINE_COOLANT_TEMPERATURE[i-2];
Marcelocostanzo 2:17d61cc5f0c0 316
Marcelocostanzo 2:17d61cc5f0c0 317 int VAL_A = strtol(DATA_A,NULL,16);
Marcelocostanzo 2:17d61cc5f0c0 318
Marcelocostanzo 2:17d61cc5f0c0 319 //pc.printf("%i\r",VAL_A);
Marcelocostanzo 2:17d61cc5f0c0 320
Marcelocostanzo 2:17d61cc5f0c0 321 ENGINE_COOLANT_TEMPERATURE = VAL_A - 40;
Marcelocostanzo 0:81f7d0ea45b6 322
Marcelocostanzo 1:7fa61b250083 323 //pc.printf("temp ar %i\r",INTAKE_AIR_TEMPERATURE);
Marcelocostanzo 0:81f7d0ea45b6 324
Marcelocostanzo 1:7fa61b250083 325 //for(int j = 0; j < i; j++)
Marcelocostanzo 1:7fa61b250083 326 //{
Marcelocostanzo 1:7fa61b250083 327 //pc.printf("%c",RESPONSE_INTAKE_AIR_TEMPERATURE[j]);
Marcelocostanzo 1:7fa61b250083 328 //}
Marcelocostanzo 0:81f7d0ea45b6 329 }
Marcelocostanzo 0:81f7d0ea45b6 330
Marcelocostanzo 0:81f7d0ea45b6 331 void ask_throttle_position()
Marcelocostanzo 0:81f7d0ea45b6 332 {
Marcelocostanzo 0:81f7d0ea45b6 333 int i = 0;
Marcelocostanzo 0:81f7d0ea45b6 334
Marcelocostanzo 0:81f7d0ea45b6 335 device.printf(PID_THROTTLE_POSITION);
Marcelocostanzo 0:81f7d0ea45b6 336 device.printf(CR);
Marcelocostanzo 0:81f7d0ea45b6 337 while(!device.readable()){} //fica esperando chegar algo na serial
Marcelocostanzo 0:81f7d0ea45b6 338 while(RESPONSE_THROTTLE_POSITION[i-1]!= '\r') //chegou algo! vamos ler até o CR
Marcelocostanzo 0:81f7d0ea45b6 339 {
Marcelocostanzo 0:81f7d0ea45b6 340 RESPONSE_THROTTLE_POSITION[i] = device.getc();
Marcelocostanzo 0:81f7d0ea45b6 341 i++;
Marcelocostanzo 0:81f7d0ea45b6 342 }
Marcelocostanzo 0:81f7d0ea45b6 343
Marcelocostanzo 0:81f7d0ea45b6 344 char DATA_A[2];
Marcelocostanzo 0:81f7d0ea45b6 345 char DATA_B[2];
Marcelocostanzo 0:81f7d0ea45b6 346 char DATA_C[2];
Marcelocostanzo 0:81f7d0ea45b6 347 char DATA_D[2];
Marcelocostanzo 0:81f7d0ea45b6 348
Marcelocostanzo 0:81f7d0ea45b6 349 DATA_A[0] = RESPONSE_THROTTLE_POSITION[i-3];
Marcelocostanzo 0:81f7d0ea45b6 350 DATA_A[1] = RESPONSE_THROTTLE_POSITION[i-2];
Marcelocostanzo 0:81f7d0ea45b6 351
Marcelocostanzo 0:81f7d0ea45b6 352 int VAL_A = strtol(DATA_A,NULL,16);
Marcelocostanzo 0:81f7d0ea45b6 353
Marcelocostanzo 0:81f7d0ea45b6 354 //pc.printf("%i\r",VAL_A);
Marcelocostanzo 0:81f7d0ea45b6 355
Marcelocostanzo 0:81f7d0ea45b6 356 THROTTLE_POSITION = 100.0f/255.0f;
Marcelocostanzo 0:81f7d0ea45b6 357 THROTTLE_POSITION = THROTTLE_POSITION * VAL_A;
Marcelocostanzo 0:81f7d0ea45b6 358
Marcelocostanzo 1:7fa61b250083 359 //pc.printf("tbi %.2f\r",THROTTLE_POSITION);
Marcelocostanzo 0:81f7d0ea45b6 360
Marcelocostanzo 1:7fa61b250083 361 //for(int j = 0; j < i; j++)
Marcelocostanzo 1:7fa61b250083 362 //{
Marcelocostanzo 1:7fa61b250083 363 //pc.printf("%c",RESPONSE_THROTTLE_POSITION[j]);
Marcelocostanzo 1:7fa61b250083 364 //}
Marcelocostanzo 0:81f7d0ea45b6 365 }
Marcelocostanzo 0:81f7d0ea45b6 366
Marcelocostanzo 0:81f7d0ea45b6 367 void ask_oxygen_sensor()
Marcelocostanzo 0:81f7d0ea45b6 368 {
Marcelocostanzo 0:81f7d0ea45b6 369 int i = 0;
Marcelocostanzo 0:81f7d0ea45b6 370
Marcelocostanzo 0:81f7d0ea45b6 371 device.printf(PID_OXYGEN_SENSOR);
Marcelocostanzo 0:81f7d0ea45b6 372 device.printf(CR);
Marcelocostanzo 0:81f7d0ea45b6 373 while(!device.readable()){} //fica esperando chegar algo na serial
Marcelocostanzo 0:81f7d0ea45b6 374 while(RESPONSE_OXYGEN_SENSOR[i-1]!= '\r') //chegou algo! vamos ler até o CR
Marcelocostanzo 0:81f7d0ea45b6 375 {
Marcelocostanzo 0:81f7d0ea45b6 376 RESPONSE_OXYGEN_SENSOR[i] = device.getc();
Marcelocostanzo 0:81f7d0ea45b6 377 i++;
Marcelocostanzo 0:81f7d0ea45b6 378 }
Marcelocostanzo 0:81f7d0ea45b6 379
Marcelocostanzo 0:81f7d0ea45b6 380 char DATA_A[2];
Marcelocostanzo 0:81f7d0ea45b6 381 char DATA_B[2];
Marcelocostanzo 0:81f7d0ea45b6 382 char DATA_C[2];
Marcelocostanzo 0:81f7d0ea45b6 383 char DATA_D[2];
Marcelocostanzo 0:81f7d0ea45b6 384
Marcelocostanzo 0:81f7d0ea45b6 385 DATA_A[0] = RESPONSE_OXYGEN_SENSOR[i-5];
Marcelocostanzo 0:81f7d0ea45b6 386 DATA_A[1] = RESPONSE_OXYGEN_SENSOR[i-4];
Marcelocostanzo 0:81f7d0ea45b6 387
Marcelocostanzo 0:81f7d0ea45b6 388 DATA_B[0] = RESPONSE_OXYGEN_SENSOR[i-3];
Marcelocostanzo 0:81f7d0ea45b6 389 DATA_B[1] = RESPONSE_OXYGEN_SENSOR[i-2];
Marcelocostanzo 0:81f7d0ea45b6 390
Marcelocostanzo 0:81f7d0ea45b6 391 int VAL_A = strtol(DATA_A,NULL,16);
Marcelocostanzo 0:81f7d0ea45b6 392 int VAL_B = strtol(DATA_B,NULL,16);
Marcelocostanzo 0:81f7d0ea45b6 393
Marcelocostanzo 0:81f7d0ea45b6 394 //pc.printf("%i\r",VAL_A);
Marcelocostanzo 0:81f7d0ea45b6 395 //pc.printf("%i\r",VAL_B);
Marcelocostanzo 0:81f7d0ea45b6 396
Marcelocostanzo 0:81f7d0ea45b6 397 OXYGEN_SENSOR = VAL_A / 200.0f;
Marcelocostanzo 0:81f7d0ea45b6 398
Marcelocostanzo 0:81f7d0ea45b6 399 SHORT_TERM_FUEL_TRIM = ((100.0f / 128.0f) * VAL_B) - 100.0f;
Marcelocostanzo 0:81f7d0ea45b6 400
Marcelocostanzo 1:7fa61b250083 401 //pc.printf("sonda %f\r",OXYGEN_SENSOR);
Marcelocostanzo 1:7fa61b250083 402 //pc.printf("trim %f\r",SHORT_TERM_FUEL_TRIM);
Marcelocostanzo 0:81f7d0ea45b6 403
Marcelocostanzo 1:7fa61b250083 404 //for(int j = 0; j < i; j++)
Marcelocostanzo 1:7fa61b250083 405 //{
Marcelocostanzo 1:7fa61b250083 406 //pc.printf("%c",RESPONSE_OXYGEN_SENSOR[j]);
Marcelocostanzo 1:7fa61b250083 407 //}
Marcelocostanzo 0:81f7d0ea45b6 408 }
Marcelocostanzo 0:81f7d0ea45b6 409
Marcelocostanzo 0:81f7d0ea45b6 410 void ask_fuel_rail_pressure()
Marcelocostanzo 0:81f7d0ea45b6 411 {
Marcelocostanzo 0:81f7d0ea45b6 412 int i = 0;
Marcelocostanzo 0:81f7d0ea45b6 413
Marcelocostanzo 0:81f7d0ea45b6 414 device.printf(PID_FUEL_RAIL_PRESSURE);
Marcelocostanzo 0:81f7d0ea45b6 415 device.printf(CR);
Marcelocostanzo 0:81f7d0ea45b6 416 while(!device.readable()){} //fica esperando chegar algo na serial
Marcelocostanzo 0:81f7d0ea45b6 417 while(RESPONSE_FUEL_RAIL_PRESSURE[i-1]!= '\r') //chegou algo! vamos ler até o CR
Marcelocostanzo 0:81f7d0ea45b6 418 {
Marcelocostanzo 0:81f7d0ea45b6 419 RESPONSE_FUEL_RAIL_PRESSURE[i] = device.getc();
Marcelocostanzo 0:81f7d0ea45b6 420 i++;
Marcelocostanzo 0:81f7d0ea45b6 421 }
Marcelocostanzo 0:81f7d0ea45b6 422
Marcelocostanzo 0:81f7d0ea45b6 423 char DATA_A[2];
Marcelocostanzo 0:81f7d0ea45b6 424 char DATA_B[2];
Marcelocostanzo 0:81f7d0ea45b6 425 char DATA_C[2];
Marcelocostanzo 0:81f7d0ea45b6 426 char DATA_D[2];
Marcelocostanzo 0:81f7d0ea45b6 427
Marcelocostanzo 0:81f7d0ea45b6 428 DATA_A[0] = RESPONSE_FUEL_RAIL_PRESSURE[i-5];
Marcelocostanzo 0:81f7d0ea45b6 429 DATA_A[1] = RESPONSE_FUEL_RAIL_PRESSURE[i-4];
Marcelocostanzo 0:81f7d0ea45b6 430
Marcelocostanzo 0:81f7d0ea45b6 431 DATA_B[0] = RESPONSE_FUEL_RAIL_PRESSURE[i-3];
Marcelocostanzo 0:81f7d0ea45b6 432 DATA_B[1] = RESPONSE_FUEL_RAIL_PRESSURE[i-2];
Marcelocostanzo 0:81f7d0ea45b6 433
Marcelocostanzo 0:81f7d0ea45b6 434 int VAL_A = strtol(DATA_A,NULL,16);
Marcelocostanzo 0:81f7d0ea45b6 435 int VAL_B = strtol(DATA_B,NULL,16);
Marcelocostanzo 0:81f7d0ea45b6 436
Marcelocostanzo 0:81f7d0ea45b6 437 //pc.printf("%i\r",VAL_A);
Marcelocostanzo 0:81f7d0ea45b6 438
Marcelocostanzo 0:81f7d0ea45b6 439 FUEL_RAIL_PRESSURE = ((VAL_A * 256) + VAL_B) * 0.1f;
Marcelocostanzo 0:81f7d0ea45b6 440
Marcelocostanzo 1:7fa61b250083 441 //pc.printf("alta %f\r",FUEL_RAIL_PRESSURE);
Marcelocostanzo 0:81f7d0ea45b6 442
Marcelocostanzo 1:7fa61b250083 443 //for(int j = 0; j < i; j++)
Marcelocostanzo 1:7fa61b250083 444 //{
Marcelocostanzo 1:7fa61b250083 445 //pc.printf("%c",RESPONSE_FUEL_RAIL_PRESSURE[j]);
Marcelocostanzo 1:7fa61b250083 446 //}
Marcelocostanzo 0:81f7d0ea45b6 447 }
Marcelocostanzo 0:81f7d0ea45b6 448
Marcelocostanzo 0:81f7d0ea45b6 449 void read_serial()
Marcelocostanzo 0:81f7d0ea45b6 450 {
Marcelocostanzo 0:81f7d0ea45b6 451 int i = 0;
Marcelocostanzo 0:81f7d0ea45b6 452
Marcelocostanzo 0:81f7d0ea45b6 453 while(!device.readable()){} //fica esperando chegar algo na serial
Marcelocostanzo 0:81f7d0ea45b6 454 while(c[i-1]!= '\r') //chegou algo! vamos ler até o CR
Marcelocostanzo 0:81f7d0ea45b6 455 {
Marcelocostanzo 0:81f7d0ea45b6 456 c[i] = device.getc();
Marcelocostanzo 0:81f7d0ea45b6 457 //pc.printf("%c",c[i]);
Marcelocostanzo 0:81f7d0ea45b6 458 i++;
Marcelocostanzo 0:81f7d0ea45b6 459 }
Marcelocostanzo 1:7fa61b250083 460 //for(int j = 0; j < i; j++)
Marcelocostanzo 1:7fa61b250083 461 //{
Marcelocostanzo 1:7fa61b250083 462 //pc.printf("%c",c[j]);
Marcelocostanzo 1:7fa61b250083 463 //}
Marcelocostanzo 0:81f7d0ea45b6 464 }
Marcelocostanzo 0:81f7d0ea45b6 465
Marcelocostanzo 0:81f7d0ea45b6 466 void OBDInit()
Marcelocostanzo 0:81f7d0ea45b6 467 {
Marcelocostanzo 0:81f7d0ea45b6 468 lcd.locate (4,0);
Marcelocostanzo 0:81f7d0ea45b6 469 lcd.printf (".");
Marcelocostanzo 0:81f7d0ea45b6 470 lcd.redraw();
Marcelocostanzo 0:81f7d0ea45b6 471 device.printf(SET_ALL_TO_DEFAULT);
Marcelocostanzo 0:81f7d0ea45b6 472 device.printf(CR);
Marcelocostanzo 1:7fa61b250083 473 wait_ms(200);
Marcelocostanzo 0:81f7d0ea45b6 474 lcd.locate (4,1);
Marcelocostanzo 0:81f7d0ea45b6 475 lcd.printf (".");
Marcelocostanzo 0:81f7d0ea45b6 476 lcd.redraw();
Marcelocostanzo 1:7fa61b250083 477 wait_ms(200);
Marcelocostanzo 0:81f7d0ea45b6 478
Marcelocostanzo 0:81f7d0ea45b6 479 lcd.locate (4,2);
Marcelocostanzo 0:81f7d0ea45b6 480 lcd.printf (".");
Marcelocostanzo 0:81f7d0ea45b6 481 lcd.redraw();
Marcelocostanzo 0:81f7d0ea45b6 482 device.printf(RESET_ALL);
Marcelocostanzo 0:81f7d0ea45b6 483 device.printf(CR);
Marcelocostanzo 1:7fa61b250083 484 wait_ms(200);
Marcelocostanzo 0:81f7d0ea45b6 485 lcd.locate (4,3);
Marcelocostanzo 0:81f7d0ea45b6 486 lcd.printf (".");
Marcelocostanzo 0:81f7d0ea45b6 487 lcd.redraw();
Marcelocostanzo 1:7fa61b250083 488 wait_ms(200);
Marcelocostanzo 0:81f7d0ea45b6 489
Marcelocostanzo 0:81f7d0ea45b6 490 lcd.locate (4,4);
Marcelocostanzo 0:81f7d0ea45b6 491 lcd.printf (".");
Marcelocostanzo 0:81f7d0ea45b6 492 lcd.redraw();
Marcelocostanzo 0:81f7d0ea45b6 493 device.printf(LINEFEED_OFF);
Marcelocostanzo 0:81f7d0ea45b6 494 device.printf(CR);
Marcelocostanzo 1:7fa61b250083 495 wait_ms(200);
Marcelocostanzo 0:81f7d0ea45b6 496 lcd.locate (4,5);
Marcelocostanzo 0:81f7d0ea45b6 497 lcd.printf (".");
Marcelocostanzo 0:81f7d0ea45b6 498 lcd.redraw();
Marcelocostanzo 1:7fa61b250083 499 wait_ms(200);
Marcelocostanzo 0:81f7d0ea45b6 500
Marcelocostanzo 0:81f7d0ea45b6 501 lcd.locate (4,6);
Marcelocostanzo 0:81f7d0ea45b6 502 lcd.printf (".");
Marcelocostanzo 0:81f7d0ea45b6 503 lcd.redraw();
Marcelocostanzo 0:81f7d0ea45b6 504 device.printf(PRINTING_SPACES_OFF);
Marcelocostanzo 0:81f7d0ea45b6 505 device.printf(CR);
Marcelocostanzo 1:7fa61b250083 506 wait_ms(200);
Marcelocostanzo 0:81f7d0ea45b6 507 lcd.locate (4,7);
Marcelocostanzo 0:81f7d0ea45b6 508 lcd.printf (".");
Marcelocostanzo 0:81f7d0ea45b6 509 lcd.redraw();
Marcelocostanzo 1:7fa61b250083 510 wait_ms(200);
Marcelocostanzo 0:81f7d0ea45b6 511
Marcelocostanzo 0:81f7d0ea45b6 512 lcd.locate (4,8);
Marcelocostanzo 0:81f7d0ea45b6 513 lcd.printf (".");
Marcelocostanzo 0:81f7d0ea45b6 514 lcd.redraw();
Marcelocostanzo 0:81f7d0ea45b6 515 device.printf(MEMORY_OFF);
Marcelocostanzo 0:81f7d0ea45b6 516 device.printf(CR);
Marcelocostanzo 1:7fa61b250083 517 wait_ms(200);
Marcelocostanzo 0:81f7d0ea45b6 518 lcd.locate (4,9);
Marcelocostanzo 0:81f7d0ea45b6 519 lcd.printf (".");
Marcelocostanzo 0:81f7d0ea45b6 520 lcd.redraw();
Marcelocostanzo 1:7fa61b250083 521 wait_ms(200);
Marcelocostanzo 0:81f7d0ea45b6 522
Marcelocostanzo 0:81f7d0ea45b6 523 lcd.locate (4,10);
Marcelocostanzo 0:81f7d0ea45b6 524 lcd.printf (".");
Marcelocostanzo 0:81f7d0ea45b6 525 lcd.redraw();
Marcelocostanzo 0:81f7d0ea45b6 526 device.printf(SET_TIMEOUT_256);
Marcelocostanzo 0:81f7d0ea45b6 527 device.printf(CR);
Marcelocostanzo 1:7fa61b250083 528 wait_ms(200);
Marcelocostanzo 0:81f7d0ea45b6 529 lcd.locate (4,11);
Marcelocostanzo 0:81f7d0ea45b6 530 lcd.printf (".");
Marcelocostanzo 0:81f7d0ea45b6 531 lcd.redraw();
Marcelocostanzo 1:7fa61b250083 532 wait_ms(200);
Marcelocostanzo 0:81f7d0ea45b6 533
Marcelocostanzo 0:81f7d0ea45b6 534 lcd.locate (4,12);
Marcelocostanzo 0:81f7d0ea45b6 535 lcd.printf (".");
Marcelocostanzo 0:81f7d0ea45b6 536 lcd.redraw();
Marcelocostanzo 0:81f7d0ea45b6 537 device.printf(TRY_PROTOCOL_0);
Marcelocostanzo 0:81f7d0ea45b6 538 device.printf(CR);
Marcelocostanzo 1:7fa61b250083 539 wait_ms(200);
Marcelocostanzo 0:81f7d0ea45b6 540 lcd.locate (4,13);
Marcelocostanzo 0:81f7d0ea45b6 541 lcd.printf (".");
Marcelocostanzo 0:81f7d0ea45b6 542 lcd.redraw();
Marcelocostanzo 1:7fa61b250083 543 wait_ms(200);
Marcelocostanzo 0:81f7d0ea45b6 544
Marcelocostanzo 0:81f7d0ea45b6 545 lcd.locate (4,14);
Marcelocostanzo 0:81f7d0ea45b6 546 lcd.printf (".");
Marcelocostanzo 0:81f7d0ea45b6 547 lcd.redraw();
Marcelocostanzo 0:81f7d0ea45b6 548 device.printf(ECHO_OFF);
Marcelocostanzo 0:81f7d0ea45b6 549 device.printf(CR);
Marcelocostanzo 1:7fa61b250083 550 wait_ms(200);
Marcelocostanzo 0:81f7d0ea45b6 551 lcd.locate (4,15);
Marcelocostanzo 0:81f7d0ea45b6 552 lcd.printf (".");
Marcelocostanzo 0:81f7d0ea45b6 553 lcd.redraw();
Marcelocostanzo 1:7fa61b250083 554 wait_ms(200);
Marcelocostanzo 0:81f7d0ea45b6 555
Marcelocostanzo 1:7fa61b250083 556 //device.printf("ATPP0CSV45");
Marcelocostanzo 1:7fa61b250083 557 //device.printf("ATBRD45");
Marcelocostanzo 1:7fa61b250083 558 //device.printf(CR);
Marcelocostanzo 1:7fa61b250083 559 //wait_ms(200);
Marcelocostanzo 1:7fa61b250083 560 //device.baud(57600);
Marcelocostanzo 1:7fa61b250083 561 //device.printf("ATPP0CON");
Marcelocostanzo 1:7fa61b250083 562 //device.printf(CR);
Marcelocostanzo 1:7fa61b250083 563 //wait_ms(200);
Marcelocostanzo 1:7fa61b250083 564
Marcelocostanzo 1:7fa61b250083 565 //device.printf("ATLP");
Marcelocostanzo 1:7fa61b250083 566 //device.printf(CR);
Marcelocostanzo 1:7fa61b250083 567 //wait_ms(200);
Marcelocostanzo 0:81f7d0ea45b6 568 }