This is Ben and I's final project for Embedded Systems. Our goal was to create a car diagnostic system that interfaces with the CAN bus in all US sold cars newer than 2008. We aimed to request data such as RPM, Vehicle speed, engine temp, etc and then display our findings. This software was succussful in communicating with the car and reading and writing, however it fails to accomplish it's task when dealing with certain makes of cars, specifically Honda. Included are various PID codes, functions, and files that interface with a car's CAN bus system.

Dependencies:   UniGraphic mbed

Committer:
Nrode17
Date:
Wed Jan 27 17:40:51 2016 +0000
Revision:
0:bb9076ae4c4a
Final Update for our final project

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Nrode17 0:bb9076ae4c4a 1 #include "mbed.h"
Nrode17 0:bb9076ae4c4a 2 #include "ODBII.h"
Nrode17 0:bb9076ae4c4a 3 #include "globals.h"
Nrode17 0:bb9076ae4c4a 4 #include "pavement_48x34.h"
Nrode17 0:bb9076ae4c4a 5 #include "ILI932x.h"
Nrode17 0:bb9076ae4c4a 6 #include "Arial24x23.h"
Nrode17 0:bb9076ae4c4a 7 /*
Nrode17 0:bb9076ae4c4a 8 This is Ben and I's final project for Embedded Systems. Our goal was to create a car diagnostic system that interfaces with
Nrode17 0:bb9076ae4c4a 9 the CAN bus in all US sold cars newer than 2008. We aimed to request data such as RPM, Vehicle speed, engine temp, etc and then
Nrode17 0:bb9076ae4c4a 10 display our findings. This software was succussful in communicating with the car and reading and writing, however it fails
Nrode17 0:bb9076ae4c4a 11 to accompolish it's task when dealing with certain makes of cars, specifically Honda. Included are various PID codes, functions,
Nrode17 0:bb9076ae4c4a 12 and files that interface with a car's CAN bus system.
Nrode17 0:bb9076ae4c4a 13 */
Nrode17 0:bb9076ae4c4a 14 PinName dataBus[]= {p30, p29, p28, p27, p26, p25, p24, p23};
Nrode17 0:bb9076ae4c4a 15 ILI932x myLCD(BUS_8, dataBus, p15, p17, p16, p14, p20, "myLCD", 240, 320);
Nrode17 0:bb9076ae4c4a 16 char orient = 3;
Nrode17 0:bb9076ae4c4a 17 void refresh(float engine);
Nrode17 0:bb9076ae4c4a 18
Nrode17 0:bb9076ae4c4a 19
Nrode17 0:bb9076ae4c4a 20 int main()
Nrode17 0:bb9076ae4c4a 21 {
Nrode17 0:bb9076ae4c4a 22 set_frequency(CANSPEED_500);//set the frequency to deal with the main engine ECU
Nrode17 0:bb9076ae4c4a 23 float engine_info;
Nrode17 0:bb9076ae4c4a 24 myLCD.set_orientation(orient);
Nrode17 0:bb9076ae4c4a 25 myLCD.background(Black);
Nrode17 0:bb9076ae4c4a 26 myLCD.foreground(White);
Nrode17 0:bb9076ae4c4a 27 myLCD.set_font((unsigned char*) Arial24x23);
Nrode17 0:bb9076ae4c4a 28 while(1)
Nrode17 0:bb9076ae4c4a 29 {
Nrode17 0:bb9076ae4c4a 30 if (request(ENGINE_RPM)) //used to check if we can get valid data back
Nrode17 0:bb9076ae4c4a 31 {
Nrode17 0:bb9076ae4c4a 32 engine_info = request(ENGINE_RPM);//if we can, then we're all set to go!
Nrode17 0:bb9076ae4c4a 33 refresh(engine_info);
Nrode17 0:bb9076ae4c4a 34 }
Nrode17 0:bb9076ae4c4a 35 wait(3);
Nrode17 0:bb9076ae4c4a 36 }
Nrode17 0:bb9076ae4c4a 37
Nrode17 0:bb9076ae4c4a 38
Nrode17 0:bb9076ae4c4a 39 }
Nrode17 0:bb9076ae4c4a 40
Nrode17 0:bb9076ae4c4a 41 void refresh(float engine)
Nrode17 0:bb9076ae4c4a 42 {
Nrode17 0:bb9076ae4c4a 43 myLCD.locate(myLCD.width()/2, myLCD.height()/2);
Nrode17 0:bb9076ae4c4a 44 myLCD.printf("Your info is: %f\n\r", engine);
Nrode17 0:bb9076ae4c4a 45 }
Nrode17 0:bb9076ae4c4a 46