obd ΔΙΠΛΩΜΑΤΙΚΗ

157
ΣΧΟΛΗ ΗΛΕΚΤΡΟΛΟΓΩΝ ΜΗΧΑΝΙΚΩΝ ΚΑΙ ΜΗΧΑΝΙΚΩΝ ΥΠΟΛΟΓΙΣΤΩΝ ΤΟΜΕΑΣ ΤΕΧΝΟΛΟΓΙΑΣ ΠΛΗΡΟΦΟΡΙΚΗΣ ΚΑΙ ΥΠΟΛΟΓΙΣΤΩΝ ΕΘΝΙΚΟ ΜΕΤΣΟΒΙΟ ΠΟΛΥΤΕΧΝΕΙΟ Διερεύνηση πρωτοκόλλου J1850 PWM και σχεδίαση διεπαφής επικοινωνίας με επεξεργαστή οχήματος Διπλωματική Εργασία Σπύρογλου Γεώργιος Επιβλέπων : Ιωάννης Αβαριτσιώτης Καθηγητής Ε.Μ.Π Αθήνα, Ιούλιος 2008

description

obd ΔΙΠΛΩΜΑΤΙΚΗ

Transcript of obd ΔΙΠΛΩΜΑΤΙΚΗ

  • J1850 PWM

    : ..

    , 2008

  • 2

  • 3

    J1850 PWM

    : ..

    ...... 2008

    ......... ......... ......... ... ... ...

    , 2008

  • 4

    ................................... .

    ...

    Copyright 2008 . All rights reserved. , , , . , , , . . .

  • 5

    J1850PWM:) OBD (On BoardDiagnostics) RS232.)(GUIGraphicUserInterface) Java, ,.:

    1.

    2 .

    3 SAE J1850PWM . .

    4 .

    5 . , .

    .

    :,,,,,,.

  • 6

  • 7

    Abstract

    Thisessaydescribes thedesignprocedureand the implementation in twobasicstages:

    A) FirstlyanelectroniccircuitthatobtainsOBD(OnBoardDiagnostics)datafromthecarconnectorandtransmitsittothePCthroughanRS232port.

    B) SecondlyaGUI(GraphicUserInterface),implementedinJava,whichplotstheresultsthatareobtainedfromthevehiclethroughtheboard.

    Thestructureoftheessayisthefollowing:

    The1stChapterisanoverallreviewofthemainsubjectthemeofthisessay. In the2ndChaptera flashback ismade to familiarize the readerwith the

    procedures that led to the todayprotocols and created thenecessity fornewmethodsfordataacquisitioninvehicles.

    Inthe3rdChaptertheSAEJ1850PWMprotocolisdescribedforwhichtheelectroniccircuit,whichwasmentionedabove,wasdesigned.Atthispointit should be noticed that this circuit can easily support other OBDprotocolswhicharebeyondthescopeofthisthesis.

    The 4th Chapter includes the description of the procedure that wasfollowed in order to implement the electronic circuit and theGUI. Thereader can also find the resultswhich derived from the testing of theapplications.

    In the5thChapteranevaluationof theresults ismadeand therearealsosomeconclusionsaswellassuggestionsforpossiblefutureevolution.

    In theAppendix themost fundamentalTroubleCodesare includedwiththeirexplanationwhichisfollowedbythebibliographythatwasusedforthisreport.

    Keywords:OBD2,scantool,SAEJ1850,PWM,diagnostics,automotive,protocol,troublecodes,MIL,gasemission,graphicuserinterface.

  • 8

  • 9

    11.1..................................................................................................................1222.1OnBoardDiagnosticsGeneration1...................................................................162.1.1(MIL).................................................................17

    2.1.2..........................................................................17

    2.1.3...............................................................18

    2.2OnBoardDiagnosticsGeneration2(OBDII)...................................................192.2.1OBDII...........................................................................20

    2.2.1.1...............................20

    2.2.1.2............................................................20

    2.2.1.3........................................................................20

    2.2.1.4.......................................................................22

    2.2.1.5GR.....................................................................22

    2.2.1.6.............................23

    2.2.1.7.............................................23

    2.2.1.8(MIL)...........23

    2.2.1.9...............................................................................24

    2.2.1.10............................................25

    2.2.1.11...............................................................................................25

    3SAEJ1850PWM3.1........................................................................................................................303.2DataBusTopology..........................................................303.3.............................................................................................303.4................................................................................313.4.1ApplicationLayer....................................................31

    3.4.2DataLinkLayer.................................34

    3.4.2.1............................................................................39

    3.4.2.1.1CyclicRedundancyCheck(CRC).......................................................39

    3.4.2.1.2/............................................................41

    3.4.2.1.3OutofRangeData...............................41

  • 10

    3.4.2.1.4Bits.............................................................42

    3.4.2.1.5......................................42

    3.4.2.2.....................................................................42

    3.4.3PhysicalLayer.................................................................42

    3.4.3.1.........................................................................43

    3.4.3.2..........................................................43

    3.4.3.3....................................................................43

    3.4.3.4..........................................................................43

    3.4.3.5Bit............................................................................................44

    3.4.3.6................................................48

    3.4.3.7..............................52

    3.4.3.8........................................................53

    3.5NetworkImplementation..............................................5544.1............................604.1.1..................................................................................................60

    4.1.2J1850PWM...................................................................................61

    4.1.3RS232.............................................................................................62

    4.1.4CANISO9141......................................................................63

    4.1.5.................................................................................63

    4.1.6..........................................................................................65

    4.2(GUI).............................................685,5.1...................................................................................765.2....................................................................76......................................................................................................79....................................................................................................107....................................................................................................157

  • 11

  • 12

    1.1

    DataLinkConnectorRS232.,NetBeansJava, . , , .SAEJ1850PWM.

    : ,

    ,. , .

    . .

    . ,.

    . .

  • 13

    .

  • 14

  • 15

  • 16

    2.1 OnBoardDiagnosticsGeneration1 1985, , OnBoard system regulations ( )(OBD)1988.EngineControl Module (ECM) ( ) , . , . :

    1) .

    2) .

    OBD . :

    1) 2) 3) (ExhaustgasrecirculationEGR)

    OBD :

  • 17

    2.1.1 (MIL): , , ECM (Engine Control Module) . ,. , . , (Keyonbulb).. , .2.1.2 OBD ECM . ,

    :

    EGR

  • 18

    ECM . Toyota CM ECMBATT.2.1.3 , OBD . , actuators () ECM /, ECM. . .. OBD Toyota 20 ,. (2.1) :

    2.1

  • 19

    2.2 OnBoardDiagnosticsGeneration2(OBDII)OBD ,OBD ( 1988). . , . , / , OBD CARB.OBD II1994 1996,, , (canister purge system monitoring), (secondary air systemmonitoring) (flow rate) EGR . , . OBD II , , .OBDIIDataLinkConnector(DLC)., , , OBD II, (SocietyofAutomotiveEngineersSAE).OBDII

  • 20

    . ,/OBDII.2.2.1 OBDIIOBDII.2.2.1.1 ( ) / switching leanrich,richleanswitchtime.2.2.1.2 ,,, . . , , , , , OBD II. , (DTC) . , ,(freezeframe).2.2.1.3,EMC . , . , (

  • 21

    ), ().OBDII . EC ,. , , ., . (2.2) :

    2.2: ECM Ne G . , ECM . , . , .

  • 22

    2.2.1.4 (suboxygen) (2) , switching switching (1) . switching . ,switching(2) (1). , (2) . ( 2.3) :

    2.3:ECMswitching . switching , .2.2.1.5GR

    EGR(flowrate) (flow rate) .,

  • 23

    EGR. EGR.2.2.1.6vaporative Purge System monitoring ( )

    , ECM .,ECM . BDII1995.2.2.1.7 (Secondary Air SystemMonitoring),,,, ECM .2.2.1.8(MIL), . .OBDII .OBDII . () .

  • 24

    ECMBATT.2.2.1.9OBDII.,EGR . . , , , . ECM . , . / () OBD . . (2.4):

  • 25

    2.4: : CARB OBD II , CM ( ).

    2.2.1.10,OBDII . (2.5):

    2.5:, ,

  • 26

    ECM (freeze frame data). H.2.2.1.11 OBD II . . , . , OBD IIOBDII., , . OBDII:

    (once per trip)

  • 27

    2.3 1990() 15 1990, OBD:

    EGR

    vaporative Purge Flow Meter ( 95)

    (Lexus)

  • 28

    .

    .

    .

    .1990,96 41 .OBDII(2.6):

    2.6 OBDII J1850PWM, SAE J1850Class B. .

  • 29

    SAE J1850 PWM

  • 30

    3.1 J1850PWM(PulseWidthModulation) (openarchitecture). . Carrier Sense Multiple Access(CSMA) nondestructive contention resolution. , ..3.2 DataBusTopology , . (simple level bus topology), . . (activepassive). :......3.3 , J1850 (masterless buscontrol). .

  • 31

    (). .3.4 J1850 . ,.3.4.1 ApplicationLayer , . , . : . .:

    . .

    : .

    : . , .

    (recommended

  • 32

    practice) (recommendedpractice).SAE J1979 SAE J2190 . .

    :SAE J1979SAE J2190 , , .

    :SAE J2012 (DTC Diagnostics Trouble Codes) .SAE J1979 SAE J2190 . , SAEJ2012. . : 5.1)P,B,CU.:

    P=Powertrain() B=Body() C=Chassis() U=Undefined()

    2) OBD II .0:

  • 33

    0: 0 OBD II .

    1:1.

    3) . :

    1:1. 2:2. 3:3. 4:4. 5:5 6:6 7: 7 (transmission)

    8: To 8 7 .

    9: 0:

    4) O .

    . B,CU.

    : (NetworkInterface Device) . , bytes . , .

  • 34

    3.4.2 DataLinkLayer bits. , bits . , /.:

    : . .

    : . . , . .

    : .() ,. .

    : , (nondestructive bitbybit arbitration) . , bits .

    : . ,

  • 35

    . .

    Byte (Byte Buffering): byte ..

    : idle,SOF,DATA_0,...,DATA_N,CRC,EOD,NB,IFR_1,...,IFR_N,EOF,

    IFS,idle 3.1:

    idle

    (), SOFIFS. IFS. idle bus, . ,. .

    SOF

    Start Of FrameCRC.

    DATA

    Bytes(8bits). bytes , 8bits, . PulseWidthModulation(PWM)41.6Kbps SOF EOF( SOF EOF) 101 bit bytes ( SOF, EOD, EOF IFS)12bytes.

  • 36

    EOD

    End Of Data(IFR). (IFR) EODEOF.IFR End of Frame(EOF).IFR, IFRbytesEOD.

    CRCCRCByte(IFR)CRC.3.4.2.1.1

    NBBit NormalizationBit(VPW)J1850VPW.

    IFR

    Byte(s) InFrameResponseByte(s)IFR(*).

    EOF

    End of Frame EOF .byte( IFR bytes, ) ., EOF .

    IFS

    InterFrameSeparation InterFrame Separation (IFS) . IFS. SOF EOF,

  • 37

    . SOF: a. IFS. b. EOF.

    BRK

    BreakM(readytoreceive)

    3.1

    *Bytes InFrameResponse (IFR):InFrameResponse,bytesEOD.bitIFRbyte EOF, .IFRbytes:

    a. Byte b. byte (

    (ID) ).

    c. bytes, . bytes . byte . , byte byte . , byte (. ) , byte.

    d. bytes , .bytesCRCbytebytes.

  • 38

    IFRbytes. data bytes,CRCbytes,IFRbytes.

    3.1IFRBytes.

    : SOF,EOD, NB, EOF, IFS, BRK byte oriented byteboundaries.

    bits:bitMSB(bitMostSignificantbit).

    3.1:

  • 39

    : bits,bittimes . Pulse Width Modulation (PWM) 41.6 Kbps SOF EOF ( EOF) 101 bits. bytes SOF,EOD,EOF,IFS)12bytes.

    3.4.2.1 . .3.4.2.1.1CyclicRedundancyCheck(CRC)byte3bytes.CRC:

    a. () CRC 1SOF.

    b. bits SOF CRC Data SegmentPolynomial D(X). frame, nbitnframebits.

    c. ToCRCX8+X4+X3+X2+1 P(X). d. Modulo2 R(X):

    :Q(X).

    e. CRCbyte____R(X),

    ____R(X)

    R(X). f. M(X):

    Install Equation Editor and double-click here to view equation.

    Install Equation Editor and double-click here to view equation.

  • 40

    g. ,

    CRCbyte CRC. CRC X7 +X6 +X2 (C4 hex) .

    h. CRCbytes 3.2.

    Bytes(hex) CRC(hex)

    00 00 00 00 59

    F2 01 83 37

    0F AA 00 55 79

    00 FF 55 11 B8

    33 22 55 AA BB CC DD EE FF CB

    92 6B 55 8C

    FF FF FF FF 74

    3.2:Frames&CRCBytesi. CRC

    . j. CRCIFR

    CRC, .CRCIFRbytes,SOF,EOD,EOF,NB CRC (datadelimiters).

    3.2CRC,3.3CRC..

  • 41

    3.4.2.1.2/ / . .3.4.2.1.3OutofRangeData . , , :

    3.2:CRC

    3.3:CRC

  • 42

    a. , .

    b. ..

    3.4.2.1.4Bits bits10.3.4.2.1.5 EODEOF, byte, .3.4.2.2 :

    bit.IFSEOF.

    : . IFR ..

    3.4.3 PhysicalLayer . ,bit., , ,

  • 43

    .3.4.3.1 ..,.3.4.3.2 (unit loads). , . , .3.4.3.3 .3.4.3.4 .3.3.

    OnVehicleNetworkLength

    35

    OffVehicleNetworkLength

    5

    TotalVehicleNetworkLength

    40

    Maximum 32

  • 44

    numberofstandardunitloads ()

    Offvehicleloadresistance

    10.6min.

    Offvehiclecapacitance

    500pFmax.

    3.3:3.4.3.5 Bit , . , .J1850bit,(PWM) Variable PulseWidth (VPW). PulseWidthModulation. .bits , ., , majority vote sampling .J1850PWMbits: a. 1bit b. 0bit c. StartofFrame(SOF) d. EndofData(EOD) e. EndofFrame(EOF)

    f. InterFrameSeparation(IFS)

    bits:

  • 45

    a) 1: bit 1, Tp3Tp1. Tp3. 3.4:

    3.4

    b)0: ,bit0, Tp3Tp2.3.5:

    3.5

    c) Start of Frame (SOF) Tp5,Tp7,bitTp43.6:

  • 46

    3.6

    d) nd ofData (EOD) .IFR,EODbit(.3.7).IFR,bit,(EOF). IFR, byte(s) bit, Tp4 bit .bitbyteTp4bit,(Tp5) EODEOF.

    3.7

    e) End of Frame (EOF) ., EOF EOD. byte ( IFR,).EOF Tp5 bit ,.

  • 47

    f)InterFrameSeparation(IFS) . SOFIFS(Tp6bit, EOF .Break(BRK).PWM Break SOF, ().Break IFS, (Tp9Break). , , . H3.8:

    3.8

    Idle Bus (Idle) . , (3.9).

  • 48

    3.9

    3.4.3.6 PWMPWMSymbolTimingRequirements PWM .SOFbit (leading edge) . (SOFbits) , , , , .3.4PWMbit24s(41.6Kbps):

    Tx,min Tx,nom Tx,max Rx,min Rx,max

    Tp1:1 6 7 8 4 10

    Tp2:0 14 15 16 12 18

    Tp3:Bit 23 24 25 21 27

    Tp4:SOF/EOD

    47 48 49 42 54

    Tp5:EOF 70 72 N/A1 63 N/A1

    Tp6:IFS 93 96 N/A2 84 N/A2

    Tp7:SOF 29 31 32 27 34

    Tp8:BRK 37 39 41 35 43

    Tp9: 116 120 N/A2 105 N/A2

  • 49

    BRKIFS

    3.4:PWM(sec)

    , , . , 11s,1(Tp1)0(Tp2). CRCByte.3.10 .

    Tp1(min)Tp1(max) 1, Tp2(min)Tp2(max)0.Tp1(max)Tp2(min) 10.bit (Contention Detection) (=conflicting) bits.

    3.10:Tp1Tp2

  • 50

    .bitbybit conflicting . bit. .BitbyBitconflicts.bit, SOF .HBitbybit. . , bit. :. bit(

    ). byte 28byteCRCbytebytesframe. .

    . bits ( 8) byte, .

    .3.11.

  • 51

    3.11:, . bit . . .bitsSOF EOF, IFR. , . , , . bit . . , ( ) ,

  • 52

    . ,bytesSOF , . bytes .3.4.3.7NodeWakeUpViaPhysicalLayer . Session Layer, , .(),,():) Unbiased Biased ( ),. unbiased . , biased . ,. biased unbiased.Biased( ), . . () ., , . (unpowered). ,

  • 53

    ().unbiasedbiased,,, , biased. .)IndividualNodes : UnpoweredNode:

    ,.

    SleepingNode: () (lowpower standbymode), . host . .

    //Awake /Operational An awake /operational: . . .

    3.4.3.8 Physical Layer FaultConsiderations (RequiredFaultTolerantModes ): :

    .

  • 54

    : , .

    : ,.

    : , .

    , (Optional FaultTolerantModes).biasing, . ,bit:(1) +(2) +(3) +.(4) +.,,. , . + , .(3.5)DCPWM:

    Min Typ Max

    InputHighVoltage Vih 2.80 6.25 volts

    InputLowVoltage Vil 1.00 2.20 volts

    OutputHighVoltage Voh 3.80 5.25 volts

    OutputLowVoltage Vol 0.00 1.20 volts

  • 55

    3.5:DCPWM3.5 NetworkImplementation bytes (Header). bytes . ( 3.1, 3.2, 3.3)bytes.SingleByteHeader:

    Bit7 6 5 4 3 2 1 0

    AbsoluteGroundOffsetVoltage

    Vgo 0.00 1.00 volts

    Bus(+)Driver&Bus()TerminationSupplyVoltage

    Vsup 4.75 5.00 5.25 volts

    ReceiverInputCommonModeOperatingRange

    Vcm 1.80 2.75 volts

    ReceiverHysteresis&Overdrive

    Vhys 180 mvolts

    NetworkResistance(eachwire)

    Rload 85 378 ohms

    NetworkCapacitance(eachwire)

    Cload 500 15,000 pF

    NetworkTimeConstant2 Tload 1.35 sec

    SignalTransitionTime Tt 1.75 sec

    NodeResistance(unitload,eachwire)

    Rul 2,880 ohms

    NodeCapacitance(unitload,eachwiretoground)

    Culg 250 pF

    NodeCapacitance(unitload,wiretowire)

    Culw 10 pF

    NodeLeakageCurrent(eachwireactivestate)

    IleakA 100 Amp

    NodeLeakageCurrent(eachwirepassivestate,unpowerednode)

    IleakPU 100 Amp

    NodeLeakageCurrent(eachwirepassivestate,powerednode)

    IleakPP 20 Amp

  • 56

    ID(256)

    OneByteFormofConsolidatedHeader:

    Bit7 6 5 4 3 2 1 0

    X x x H=1 X X x x

    ID(128)

    3.1:SingleByteHeader&OneByteFormofConsolidatedHeader

    ThreeByteFormofConsolidatedHeader

    Byte1 Byte2 Byte3

    .3.3

    3.2:ThreeByteFormofConsolidatedHeader

    Byte1ofThreeByteFormofConsolidatedHeader:

    Bit7 6 5 4 3 2 1 0

    P P P 0 K Y Z Z

    (07) H=0 (.)

    Bit

    K InFrameResponse(IFR) 01

    IFRIFR

    Y

    01

    ZZ 00011011

    J2178/1.

    3.3:FirstByteofThreeByteFormofConsolidatedHeader

  • 57

    , (GUI). .

  • 58

  • 59

  • 60

    4.1.:

    4.1.1 ELM327, Motorola (PIC18F2480) OBD.

    4.1:

    4MHz , 4 LEDs . 78L05 12V 5V . 1A, 100mA.

  • 61

    (R34, R35) . (05V). ( ). (, , ) .

    4.2:,

    4.1.2 J1850PWM J1850PWM 5V. J1850+NPN(Q1)PNP(Q2), J1850 NPN (Q3). .PNP Q4, . Q4 D31V,.R11,R12Q4.R36Q4.

  • 62

    4.3:J1850PWM4.1.3 RS232 , RS232 . .RS232 , 9pin . , . ISO9141 CAN, .

  • 4.1.CA4.1.

    4

    AN Transce W,0.

    R

    5

    CA

    CANeiver, 4W. R20R29.1V(risin

    4.4

    ANISO

    NPN 13 21ng)4.7

    63

    :

    O9141

    .8V 7V(falling

    4.5:

    R

    MCP. , Q6

    g),.

    J1962

    RS232

    P2551, Q7, L

    2

    IS 51 (),

    ( .

    O9141,

    0

    (J1962), 4.5).

  • 64

    pinJ1962:

    Pin Pin 1 (SWCAN) 9 2 J1850+ 10 J18503 MSCANH 11 MSCANL4 ChassisGround 12 5 SignalGround 13 6 CANH 14 CANL7 ISO9141KLine 15 ISO9141LLine8 16 VehicleBattery

    SAEJ1979,.

    4.6:CAN,ISO9141.

    ISO-9141

    CAN

  • 65

    4.1.6

    :

  • 66

    4.7:

  • 67

    (top bottom) layer:

    4.8: Top Layer

    4.9: Bottom Layer :

  • 68

    4.1:

    4.2: 4.2 (GUI)() , , ,.,:

  • 69

    4.10:BatteryVoltage (ATRV).GetDTCs, 010C . , . , . , Unknown Trouble Code. , :

  • 70

    4.11:.

    ClearDTCs, 04, MIL.ClearDTCs , . 4.11(), , ()3.

  • 71

    4.12:

    ,RPMSpeed(), . 300msec , . , , . , ,.

  • 72

    , , .

    4.13: , .

  • 73

    4.14:

    . .

  • 74

  • 75

  • 76

    5.1 :FordMondeo1.8(2004), serial adaptor J1962 OBD II connector (lap top). .. (. 4.10 ). .. . . 5.2:5.2: GUI

    . , , , .

    . ( ).

  • 77

    bywire().

    SAEJ1850PWMCANISO .

    PCodes B,C U Codes Body, Chassis Network.

    (..FlexRay), (, ), bywire , ,/.,,(.).

  • 78

  • 79

  • 80

    , .6:A.1 Main.javapackage jserial; import javax.comm.*; /** * @author George */ public class Main { /** * @param args the command line arguments */ SimpleRead serialReader; SimpleWrite serialWriter; final SerialGUI serialwin; SerialPort serialPortCOM3; public Main() { serialReader = new SimpleRead(); serialPortCOM3 = serialReader.serialPort; serialWriter = new SimpleWrite(serialPortCOM3); serialwin = new SerialGUI(); Gauge gauge1 = serialwin.getCanvas1(); gauge1.setMaximum(7); gauge1.setCurrent(3); gauge1.setLegend("RPM*1000"); gauge1.setUnits(""); Gauge gauge2 = serialwin.getCanvas2(); gauge2.setMaximum(240); gauge2.setCurrent(70); gauge2.setLegend("KPH"); gauge2.setUnits(""); java.awt.EventQueue.invokeLater(new Runnable() { public void run() { serialwin.setVisible(true); } }); serialReader.main = this; serialWriter.main = this; serialwin.main = this; } public static void main(String[] args) { Main main = new Main(); } }

  • 81

    A.2 SerialGUI.java /* * SerialGUI.java * Created on January 9, 2008, 6:29 PM */ package jserial; import javax.swing.JOptionPane; import javax.swing.JTextArea; import javax.swing.JTextField; /** * * @author George */ public class SerialGUI extends javax.swing.JFrame { Main main; /** Creates new form SerialGUI */ public SerialGUI() { setTitle("OBD II ScanTool"); initComponents(); } /** This method is called from within the constructor to * initialize the form. */ // //GEN-BEGIN:initComponents private void initComponents() { popupMenu1 = new java.awt.PopupMenu(); jPanel1 = new javax.swing.JPanel(); jButton1 = new javax.swing.JButton(); jScrollPane2 = new javax.swing.JScrollPane(); jTextArea2 = new javax.swing.JTextArea(); jButton2 = new javax.swing.JButton(); jButton3 = new javax.swing.JButton(); jTextField1 = new javax.swing.JTextField(); jButton4 = new javax.swing.JButton(); jButton5 = new javax.swing.JButton(); canvas1 = new Gauge(0,7); canvas2 = new Gauge(0,240); popupMenu1.setLabel("PopupMenu"); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jButton1.setText("Speed"); jButton1.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jButton1MouseClicked(evt); } });

  • 82

    jTextArea2.setColumns(20); jTextArea2.setFont(new java.awt.Font("Tahoma", 0, 12)); jTextArea2.setRows(5); jTextArea2.setText("These Trouble Codes were retreived from the vehicle: "); jScrollPane2.setViewportView(jTextArea2); jButton2.setText("Get DTCs"); jButton2.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jButton2MouseClicked(evt); } }); jButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt); } }); jButton3.setText("Battery Voltage"); jButton3.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jButton3MouseClicked(evt); } }); jTextField1.setText("0.0V"); jButton4.setText("Clear DTCs"); jButton4.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jButton4MouseClicked(evt); } }); jButton5.setText("RPM"); jButton5.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jButton5MouseClicked(evt); } }); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

  • 83

    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup() .addComponent(canvas2, javax.swing.GroupLayout.PREFERRED_SIZE, 306, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(canvas1, javax.swing.GroupLayout.PREFERRED_SIZE, 295, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jButton4, javax.swing.GroupLayout.DEFAULT_SIZE, 139, Short.MAX_VALUE) .addComponent(jButton2, javax.swing.GroupLayout.DEFAULT_SIZE, 139, Short.MAX_VALUE) .addComponent(jButton3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 139, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 403, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(63, 63, 63))) .addGap(93, 93, 93)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addGap(119, 119, 119) .addComponent(jButton1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 256, Short.MAX_VALUE) .addComponent(jButton5) .addGap(223, 223, 223))) .addContainerGap()) );

  • 84

    jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(canvas1, 0, 0, Short.MAX_VALUE) .addComponent(canvas2, javax.swing.GroupLayout.PREFERRED_SIZE, 275, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jButton5) .addComponent(jButton1)) .addGap(33, 33, 33) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 118, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(41, 41, 41) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jButton3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(62, 62, 62)) ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()

  • 85

    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(73, 73, 73)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap(37, Short.MAX_VALUE) .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) ); pack(); }// //GEN-END:initComponents private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton1MouseClicked main.serialReader.kph = true; main.serialReader.ctc = false; main.serialReader.rpm = false; main.serialReader.atrv = false; main.serialWriter.write("010C"); }//GEN-LAST:event_jButton1MouseClicked private void jButton2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton2MouseClicked main.serialReader.kph = false; main.serialReader.ctc = true; main.serialReader.rpm = false; main.serialReader.atrv = false; jTextArea2.setText(""); main.serialWriter.write("03"); }//GEN-LAST:event_jButton2MouseClicked private void jButton3MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton3MouseClicked main.serialReader.kph = false; main.serialReader.ctc = false; main.serialReader.rpm = false; main.serialReader.atrv = true; jTextField1.setText(""); main.serialWriter.write("ATRV"); }//GEN-LAST:event_jButton3MouseClicked private void jButton4MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton4MouseClicked Object[] options = {"Yes", "No"}; int n = JOptionPane.showOptionDialog(jPanel1, "Are you sure?", "Reset Confirmation", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE,

  • 86

    null, options, options[1]); System.out.println(n); if (n == 0) { main.serialWriter.write("04"); } JOptionPane.showMessageDialog(jPanel1, "DTC successfully cleared"); }//GEN-LAST:event_jButton4MouseClicked private void jButton5MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton5MouseClicked main.serialReader.kph = false; main.serialReader.ctc = false; main.serialReader.rpm = true; main.serialReader.atrv = false; jTextField1.setText(""); main.serialWriter.write("010C"); }//GEN-LAST:event_jButton5MouseClicked private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jButton2ActionPerformed public JTextField getJTextField1() { return jTextField1; } public void setJTextField1(String str) { jTextField1.setText(str); } public JTextArea getJTextArea2() { return jTextArea2; } public Gauge getCanvas1() { return (Gauge) canvas1; } public Gauge getCanvas2() { return (Gauge) canvas2; } /** * @param args the command line arguments */ public static void main(String args[]) { } // Variables declaration //GEN-BEGIN:variables private java.awt.Canvas canvas1; private java.awt.Canvas canvas2; private javax.swing.JButton jButton1; private javax.swing.JButton jButton2; private javax.swing.JButton jButton3; private javax.swing.JButton jButton4;

  • 87

    private javax.swing.JButton jButton5; private javax.swing.JPanel jPanel1; private javax.swing.JScrollPane jScrollPane2; private javax.swing.JTextArea jTextArea2; private javax.swing.JTextField jTextField1; private java.awt.PopupMenu popupMenu1; // End of variables declaration//GEN-END:variables }

    A.3 SimpleWrite.java package jserial; /** /* * @(#)SimpleWrite.java 1.12 98/06/25 SMI * * Copyright 2003 Sun Microsystems, Inc. All rights reserved. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */ import java.io.*; import java.util.*; import javax.comm.*; /** * Class declaration * @author * @version 1.10, 08/04/00 */ public class SimpleWrite { Enumeration portList; CommPortIdentifier portId; String messageString = "Testing"; SerialPort serialPort; OutputStream outputStream; boolean outputBufferEmptyFlag = false; Main main; String defaultPort = "COM1"; /** * Method declaration */ public void write(String command) { try { outputStream.write(command.getBytes()); } catch (IOException e) { } try { Thread.sleep(300); } catch (Exception e) { } } public SimpleWrite(SerialPort serialPort) {

  • 88

    this.serialPort = serialPort; boolean portFound = false; portList = CommPortIdentifier.getPortIdentifiers(); while (portList.hasMoreElements()) { portId = (CommPortIdentifier) portList.nextElement(); if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) { if (portId.getName().equals(defaultPort)) { System.out.println("Found port " + defaultPort); portFound = true; try { serialPort = (SerialPort) portId.open("SimpleWrite", 2000); } catch (PortInUseException e) { System.out.println("Port in use."); } try { //outputStream = serialPort.getOutputStream(); outputStream = serialPort.getOutputStream(); } catch (IOException e) { } try { serialPort.setSerialPortParams(9600, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } catch (UnsupportedCommOperationException e) { } try { serialPort.notifyOnOutputEmpty(true); } catch (Exception e) { System.out.println("Error setting event notification"); System.out.println(e.toString()); System.exit(-1); } } } if (!portFound) { System.out.println("port " + defaultPort + " not found."); } } } /* public static void main(String[] args) { SimpleWrite swrite = new SimpleWrite();

  • 89

    boolean portFound = false; System.out.println( "Writing \"" + swrite.messageString + "\" to " + swrite.serialPort.getName()); try { swrite.outputStream.write(swrite.messageString.getBytes()); } catch (IOException e) { } try { Thread.sleep(2000); } catch (Exception e) { } swrite.serialPort.close(); System.exit(1); } */ }

    A.4 SimpleRead.java/* * @(#)SimpleRead.java 1.12 98/06/25 SMI * * Copyright 2003 Sun Microsystems, Inc. All rights reserved. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */ package jserial; import java.io.*; import java.util.*; import javax.comm.*; import javax.swing.JComponent; /** * Class declaration * * * @author * @version 1.8, 08/03/00 */ public class SimpleRead implements Runnable, SerialPortEventListener { InputStream inputStream; SerialPort serialPort; Thread readThread; /** * Method declaration */ /** * Constructor declaration */ private javax.swing.JComponent output;

  • 90

    Main main; Hashtable troubles; boolean ctc = false; boolean kph = false; boolean atrv = false; boolean rpm = false; public SimpleRead() { troubles = CSVReader.parseCSV(); String defaultPort = "COM1"; CommPortIdentifier portId = null; Enumeration portList = CommPortIdentifier.getPortIdentifiers(); while (portList.hasMoreElements()) { portId = (CommPortIdentifier) portList.nextElement(); if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) { if (portId.getName().equals(defaultPort)) { System.out.println("Found port: "+defaultPort); break; } } } try { serialPort = (SerialPort) portId.open("SimpleReadApp", 2000); } catch (PortInUseException e) {} try { inputStream = serialPort.getInputStream(); } catch (IOException e) {} try { serialPort.addEventListener(this); } catch (TooManyListenersException e) {} serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(9600, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } catch (UnsupportedCommOperationException e) {} readThread = new Thread(this); readThread.start(); } /** * Method declaration */ public void run() { try {

  • 91

    Thread.sleep(20000); } catch (InterruptedException e) {} } /** * Method declaration */ public static String codeToString(byte[] code) { Byte fstByte = new Byte(code[0]); Byte sndByte = new Byte(code[1]); int hex1 = fstByte/16; int hex2 = fstByte%16; int hex3 = sndByte/16; int hex4 = sndByte%16; return hexToCodes(hex1) + hex2 + hex3 + hex4; } public static String hexToCodes (int hex) { int mod = hex % 4; if (hex / 4 == 0) { return "P" + mod; } else if (hex / 4 == 1) { return "C" + mod; } else if (hex / 4 == 2) { return "B" + mod; } else return "U" + mod; } public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.BI: case SerialPortEvent.OE: case SerialPortEvent.FE: case SerialPortEvent.PE: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.RI: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: break; case SerialPortEvent.DATA_AVAILABLE: byte[] readBuffer = new byte[20]; try { int numBytes = 0; while (inputStream.available() > 0) { numBytes = inputStream.read(readBuffer);

  • 92

    System.out.println("read " + numBytes + " bytes"); String textRead = new String(readBuffer,0,numBytes); System.out.println(textRead); if (kph) { int kph_value = (int) readBuffer[0]; main.serialwin.getCanvas2().setCurrent(kph_value); main.serialWriter.write("010D"); } else if (ctc) { while (numBytes > 0) { byte[] temp = new byte[2]; temp[0] = readBuffer[6-numBytes+1]; temp[1] = readBuffer[6-numBytes+2]; String res = codeToString(temp); main.serialwin.getJTextArea2().append(res + " : " + troubles.get(res) + "\n"); numBytes -= 2; } } else if (rpm) { byte[] temp = new byte[2]; temp[0] = readBuffer[1]; temp[1] = readBuffer[2]; int A = (int) temp[0]; int B = (int) temp[1]; int rpm_value = ((A*256)+B)/4; main.serialwin.getCanvas1().setCurrent(rpm_value); main.serialWriter.write("010C"); } else if (atrv) { main.serialwin.setJTextField1(textRead); } } } catch (IOException e) {} break; } } }

  • 93

    A.5 CSVReader.java package jserial; import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.util.Hashtable; import java.util.StringTokenizer; import java.util.logging.Level; import java.util.logging.Logger; /** * @author George */ public class CSVReader { static String file = "book1.csv"; public static Hashtable parseCSV() { BufferedReader bfrd = null; Hashtable result = new Hashtable(); try { String line; bfrd = new BufferedReader(new FileReader(file)); while ((line = bfrd.readLine()) != null) { StringTokenizer st = new StringTokenizer(line,";"); result.put(st.nextToken(), st.nextToken()); } } catch (IOException ex) { Logger.getLogger(CSVReader.class.getName()).log(Level.SEVERE, null, ex); } finally { try { bfrd.close(); } catch (IOException ex) { Logger.getLogger(CSVReader.class.getName()).log(Level.SEVERE, null, ex); } } return result; } public static void main(String[] args) { System.out.println(parseCSV()); } }

  • 94

    A.6 Gauge.java package jserial; /* * Copyright (c) 1995 Widget Workshop, Inc. All Rights Reserved. */ import java.awt.*; import java.awt.image.*; import java.awt.Color; import java.awt.Canvas; /** * * Accessible Attributes: * * MinimumValue Low end of the scale * MaximumValue High end of the scale * CurrentValue Current setting (where the Pointer points) * CriticalThreshold Percentage of MaxValue at which we start drawing using the Critical color * WarningThreshold Percentage of MaxValue at which we start drawing using the Warning color * Legend What we're measuring (e.g., Speed) * Units What units we're using (e.g., MPH) * * * Attributes not yet publically accessible (next version, perhaps): * * MinimumAngle Angle at which Minimum Value will be drawn * MaximumAngle Angle at which Maximum Value will be drawn * Margin Distance between the Scale and the Component's bounds() rect * Separation Distance between Gauge subobjects (e.g, between Pointer and Scale) * CriticalColor Color used to draw the Critical Section of the Scale(e.g., Color.red) * WarningColor Color used to draw the Warning Section of the Scale * NormalColor Color used to draw the Normal Section of the Scale * InternalColor Color used to draw the interior of the Scale * PenRadius Used to determine thickness of Pointer and Scale * Draw3D Should the background be drawn as a raised rectangle? * TickSize How long (in pixels) is a BigTick? * BigTick Interval starting at Minimum at which BigTicks will be drawn * LittleTick Interval starting at Minimum at which LittleTicks will be drawn * * * @author Grant R. Gainey * @version 1.0 03-JAN-1996 * */ public class Gauge extends Canvas { /* * Base attributes */

  • 95

    // Publically settable: private int minVal, maxVal, currVal; private double warnPercent, critPercent; private String legend; private String units; // Still internal-only: private Color warnColor, critColor, internalColor, normalColor; private int separation = 10; private int margin = separation; private double minAngleRads = Math.PI; // 180 degrees private double maxAngleRads = 0.0; // zero degrees private int penRadius = 1; private boolean draw3D = true; private int tickSize = 8; private int bigTick = 10; private int littleTick = 5; /* * Computed attributes (derived from Base or elsewhere) */ private int warnVal, critVal; private String maxStr, minStr; private Dimension minSize, maxSize, legendSize, unitsSize; private Point pivotLoc; private int pointerLen; private int minAngleDegs, maxAngleDegs; private Rectangle scaleRect; private FontMetrics myMetrics = null; private int halfTick = (int)Math.round(tickSize/2.0); /** * Constructs a Gauge object. Uses all default values. * @see Gauge#init */ public Gauge() { init(); }; /** * Constructs a Gauge object with specified Min and Max. * @param min Minimum Gauge value * @param max Maximum Gauge Value * @see Gauge#init */ public Gauge(int min, int max) { init(); setMinimum(min); setMaximum(max); setCurrent(min); }; /** * Constructs a Gauge with the specified Min, Max, Legend, and Units values. * @param min Minimum Value

  • 96

    * @param max Maximum Value * @param warn Percentage of Max of start of Warning area * @param crit Percentage of Max of start of Critical area * @param newLegend Gauge Legend * @param newUnits Gauge Units */ public Gauge(int min, int max, float warn, float crit, String newLegend, String newUnits) { init(); setMinimum(min); setMaximum(max); setCurrent(min); warnPercent = warn; critPercent = crit; warnVal = (int)Math.round(maxVal*warnPercent); critVal = (int)Math.round(maxVal*critPercent); setLegend(newLegend); setUnits(newUnits); }; /* * Utility Routines */ // Degrees-to-Radians private double d2r (int degs) { return Math.round((degs/180)*Math.PI); }; // Radians-to-Degrees private int r2d (double rads) { return (int)Math.round((rads/Math.PI)*180); }; // Based on current font, determine dimensions of all strings. // Reset PointerLen here. private void setStringMetrics() { if (myMetrics==null) return; minSize = new Dimension(myMetrics.stringWidth(minStr), myMetrics.getHeight()); maxSize = new Dimension(myMetrics.stringWidth(maxStr), myMetrics.getHeight()); legendSize = new Dimension(myMetrics.stringWidth(legend), myMetrics.getHeight()); unitsSize = new Dimension(myMetrics.stringWidth(units), myMetrics.getHeight()); margin += myMetrics.getHeight(); pointerLen = (int)Math.round(getSize().width/2.0) - margin - separation; }; // Return rect into which the scale-arc will be drawn private Rectangle findScaleRect() { return new Rectangle(margin, pivotLoc.y - pointerLen, 2*pointerLen, pointerLen);

  • 97

    }; // Determine locations of Pivot and Scale, and len of Pointer // Called after any size-change private void partition() { pivotLoc = new Point( getSize().width/2, getSize().height/2 ); pointerLen = (int)Math.round(getSize().width/2.0) - margin - separation; scaleRect = findScaleRect(); }; /** * init() sets Guage's attributes to a "sane" set of initial values. * * Defaults are: * * Minimum = 0 * Maximum = 200 * Current = Minimum * Legend = "Velocity" * Units = "KPH" * WarningThresh = 0.7 * CriticalThresh = 0.9 * CriticalColor = Color.red * WarningColor = Color.yellow * InternalColor = Color.black * NormalColor = getForeground() * ForegroundColor = Color.green * BackgroundColor = Color.gray * Font = "Courier", BOLD, 18 * */ protected void init() { minVal = 0; maxVal = 8; currVal = minVal; warnPercent = 0.7; critPercent = 0.9; warnVal = (int)Math.round(maxVal*warnPercent); critVal = (int)Math.round(maxVal*critPercent); units = new String("KPH"); minStr = String.valueOf(minVal); maxStr = String.valueOf(maxVal); setStringMetrics(); warnColor = Color.orange; critColor = Color.red; internalColor = Color.BLUE; partition(); minAngleDegs = r2d(minAngleRads); maxAngleDegs = r2d(maxAngleRads); setForeground(Color.green); normalColor = getForeground();

  • 98

    setBackground(Color.DARK_GRAY); setFont(new Font("Courier", Font.ITALIC, 18)); }; /** * Change the Gauge's Legend (what this Gauge is measuring; e.g., Speed or Swap Rate) * @param newLegend Legend's new value */ public void setLegend(String newLegend) { legend = newLegend; if (myMetrics!=null) { legendSize = new Dimension(myMetrics.stringWidth(legend), myMetrics.getHeight()); } repaint(); }; /** * Change the Gauge's Units (what Value is measured in; e.g., KPH or PPM) * @param newUnits Units's new value */ public void setUnits(String newUnits) { units = newUnits; if (myMetrics!=null) { unitsSize = new Dimension(myMetrics.stringWidth(units), myMetrics.getHeight()); } repaint(); }; /** * Change the Gauge's Minimum Value * @param min New Minimum */ public void setMinimum(int min) { minVal = min; minStr = String.valueOf(minVal); if (myMetrics!=null) { minSize = new Dimension(myMetrics.stringWidth(minStr), myMetrics.getHeight()); } repaint(); }; public int getMinimum() { return minVal; }; /** * Change the Gauge's Maximum Value * @param max New Maximum */ public void setMaximum(int max) { maxVal = max; maxStr = String.valueOf(maxVal);

  • 99

    if (myMetrics!=null) { maxSize = new Dimension(myMetrics.stringWidth(maxStr), myMetrics.getHeight()); } warnVal = (int)Math.round(maxVal*warnPercent); critVal = (int)Math.round(maxVal*critPercent); repaint(); }; public int getMaximum() { return maxVal; }; /** * Change the Gauge's Current Value (the value the pointer points at) * @param newCurr New Current */ public void setCurrent(int newCurr) { currVal = newCurr; repaint(); }; public int getCurrent() { return currVal; }; /** * Change the Gauge's Warning Threshold. This is the percentage of the Maximum Value * at which the Warning Region begins. * @param newWarnPercnt New Warning Threshold */ public void setWarningThreshold(float newWarnPcnt) { warnPercent = newWarnPcnt; warnVal = (int)Math.round(maxVal*warnPercent); repaint(); }; public double getWarningThreshold() { return warnPercent; }; /** * Change the Gauge's Critical Threshold. This is the percentage of the Maximum Value * at which the Critical Region begins. * @param newCritPercnt New Critical Threshold */ public void setCriticalThreshold(float newCritPcnt) { critPercent = newCritPcnt; critVal = (int)Math.round(maxVal*critPercent); repaint(); }; public double getCriticalThreshold() { return critPercent; };

  • 100

    /** * At update(); draw into an off-screen image and put up the whole * image. This clears up any flickering. */ public void update(Graphics g) { Image osImg = createImage(getSize().width, getSize().height); osImg.getGraphics().fillRect(0,0,getSize().width, getSize().height); paint(osImg.getGraphics()); g.drawImage(osImg,0,0,null); }; /** * If Draw3d is set, draw the background as a filled 3D rect in the * current Background Color. Otherwise, draw a flat rect. */ public void drawBackground(Graphics g) { g.setColor(getBackground()); if (draw3D) { for (int i=0;i

  • 101

    // Draw the critical-color segment g.setColor(critColor); g.drawArc(margin+i, margin+i, getSize().width - 2*margin - 2*i, getSize().height - 2*margin - 2*i, maxAngleDegs, (int)Math.round(minAngleDegs*(1.0-critPercent))); // Draw the warning-color segment g.setColor(warnColor); g.drawArc(margin+i, margin+i, getSize().width - 2*margin - 2*i, getSize().height - 2*margin - 2*i, (int)Math.round(minAngleDegs*(1.0-critPercent)), (int)Math.round(minAngleDegs*(critPercent-warnPercent))); // Draw the normal-color segment g.setColor(normalColor); g.drawArc(margin+i, margin+i, getSize().width - 2*margin - 2*i, getSize().height - 2*margin - 2*i, minAngleDegs, (int)Math.round(minAngleDegs*(-warnPercent))); } for (int i=minVal;i

  • 102

    * getValColor returns the color associated with the region into which the * value falls. * @param val value of interest */ public Color getValColor(int val) { if (val < warnVal) { return normalColor; } else if (val < critVal) { return warnColor; } else { return critColor; } }; /** * mapValToPoint returns a Point on the Scale for the specified value */ public Point mapValToPoint(int val) { double diffRads = minAngleRads - maxAngleRads; double valPcnt = (double)val/(double)maxVal; double valRads = minAngleRads - diffRads*valPcnt; return new Point(pivotLoc.x + (int)Math.round(Math.cos(valRads)*pointerLen), pivotLoc.y - (int)Math.round(Math.sin(valRads)*pointerLen)); }; /** * mapValToPoint returns a Point "radius" units from the Pivit for the specified value */ public Point mapValToPoint(int val, int radius) { double diffRads = minAngleRads - maxAngleRads; double valPcnt = (double)val/(double)maxVal; double valRads = minAngleRads - diffRads*valPcnt; return new Point(pivotLoc.x + (int)Math.round(Math.cos(valRads)*radius), pivotLoc.y - (int)Math.round(Math.sin(valRads)*radius)); }; /** * drawPointer draws the Pivot and the Pointer */ public void drawPointer(Graphics g) { g.setColor(getValColor(currVal)); g.fillOval(pivotLoc.x-5, pivotLoc.y-5, 11, 11); Point scalePt = mapValToPoint(currVal); for (int i=-penRadius;i

  • 103

    * * * Gauge MUST be square; take the smaller of w/h as new side-length * Gauge MUST be at least its min-size * */ public void setSize(int w, int h) { int side = Math.max(Math.min(w,h), getMinimumSize().width); super.setSize(side, side); partition(); repaint(); }; /** * @see Gauge#resize(int,int) */ public void setSize(Dimension dim) { int side = Math.max(Math.min(dim.width,dim.height), getMinimumSize().width); dim.width = side; dim.height = side; super.setSize(dim); partition(); repaint(); }; /** * @see Gauge#resize(int,int) */ public void setBounds(int x, int y, int w, int h) { int side = Math.max(Math.min(w,h), getMinimumSize().width); super.setBounds(x,y,side,side); partition(); repaint(); }; /** * A Gauge wants to be no smaller than (100,100) */ public Dimension getMinimumSize() { return new Dimension(100,100); }; /** * Gauges prefer their minSize. * @see Gauge#getMinimumSize */ public Dimension getPreferredSize() { return getMinimumSize(); }; /** * paint() paints in this order: * * Background (includes Internal area) * Scale (includes TickMarks) * Strings (Legend, Units, Min, Max) * Pointer (inlcudes Pivot)

  • 104

    * */ public void paint(Graphics g) { if (myMetrics==null) { myMetrics = getGraphics().getFontMetrics(); setStringMetrics(); } //Image osImg = createImage(size().width, size().height); //Graphics osGfx = osImg.getGraphics(); drawBackground(g); drawScale(g); drawStrings(g); drawPointer(g); //g.drawImage(osImg, 0, 0, this); //System.out.println(this.toString()); }; public void repaint() { super.repaint(); }; public void repaint(long when) { super.repaint(when); }; public void repaint(int x, int y, int w, int h) { super.repaint(x,y,w,h); }; public void repaint(long when, int x, int y, int w, int h) { super.repaint(when,x,y,w,h); }; public void processMouseEvent(java.awt.event.MouseEvent evt) {//, int x, int y) { super.processMouseEvent((java.awt.event.MouseEvent) evt);//,x,y); }; public void processMouseMotionEvent(java.awt.event.MouseEvent evt) {//, int x, int y) { super.processMouseMotionEvent((java.awt.event.MouseEvent) evt);//,x,y); }; public String toString() { String strBuf = getClass().getName(); strBuf += "Rect: " +getBounds().toString()+ '\n'; strBuf += "Min : " +minVal+ " Max: " +maxVal+ " Curr: " +currVal+ '\n'; strBuf += "wP : " +warnPercent+ " cP:" + critPercent+ '\n'; strBuf += "wV : " +warnVal+ " cV:" + critVal+ '\n'; strBuf += "Lgnd: " +legend+'\n'; strBuf += "Unit: " +units+'\n';

  • 105

    strBuf += "MnAR: " +minAngleRads+ " MnAD: " +minAngleDegs+ '\n'; strBuf += "MxAR: " +maxAngleRads+ " MxAD: " +maxAngleDegs+ '\n'; strBuf += "PivotLoc: " +pivotLoc.toString()+ '\n'; strBuf += "PtrLen: " +pointerLen+ '\n'; strBuf += "SclRect : " +scaleRect.toString()+ '\n'; return strBuf; } }

  • 106

  • 107

  • 108

    , GetDTCs:1) Codes:

    P0100 MassorVolumeAirFlowCircuitMalfunction

    P0101 MassorVolumeAirFlowCircuitRange/PerformanceProblem

    P0102 MassorVolumeAirFlowCircuitLowInput

    P0103 MassorVolumeAirFlowCircuitHighInput

    P0104 MassorVolumeAirFlowCircuitIntermittent

    P0105 ManifoldAbsolutePressure/BarometricPressureCircuitMalfunction

    P0106 ManifoldAbsolutePressure/BarometricPressureCircuitRange/PerformanceProblem

    P0107 ManifoldAbsolutePressure/BarometricPressureCircuitLowInput

    P0108 ManifoldAbsolutePressure/BarometricPressureCircuitHighInput

    P0109 ManifoldAbsolutePressure/BarometricPressureCircuitIntermittent

    P0109 IntakeAirTemperatureCircuitMalfunction

    P0110 IATCircuitMalfunction

    P0111 IntakeAirTemperatureCircuitRange/PerformanceProblem

    P0112 IntakeAirTemperatureCircuitLowInput

    P0113 IntakeAirTemperatureCircuitHighInput

    P0114 IntakeAirTemperatureCircuitIntermittent

    P0115 EngineCoolantTemperatureCircuitMalfunction

    P0116 EngineCoolantTemperatureCircuitRange/PerformanceProblem

    P0117 EngineCoolantTemperatureCircuitLowInput

    P0118 EngineCoolantTemperatureCircuitHighInput

    P0119 EngineCoolantTemperatureCircuitIntermittent

    P0120 ThrottlePositionSensor/SwitchACircuitMalfunction

    P0121 ThrottlePositionSensor/SwitchACircuitRange/PerformanceProblem

    P0122 ThrottlePositionSensor/SwitchACircuitLowInput

    P0123 ThrottlePositionSensor/SwitchACircuitHighInput

    P0124 ThrottlePositionSensor/SwitchACircuitIntermittent

    P0125 InsufficientCoolantTemperatureforClosedLoopFuelControl;ECTExcessiveTimetoClosedLoopFuelControl

  • 109

    P0126 InsufficientCoolantTemperatureforStableOperation

    P0128 CoolantThermostatMalfunction

    P0130 O2SensorCircuitMalfunction(Bank1Sensor1)

    P0131 O2SensorCircuitLowVoltage(Bank1Sensor1)

    P0132 O2SensorCircuitHighVoltage(Bank1Sensor1)

    P0133 O2SensorCircuitSlowResponse(Bank1Sensor1)

    P0134 O2SensorCircuitNoActivityDetected(Bank1Sensor1)

    P0135 O2SensorHeaterCircuitMalfunction(Bank1Sensor1)

    P0136 O2SensorCircuitMalfunction(Bank1Sensor2)

    P0137 O2SensorCircuitLowVoltage(Bank1Sensor2)

    P0138 O2SensorCircuitHighVoltage(Bank1Sensor2)

    P0139 O2SensorCircuitSlowResponse(Bank1Sensor2)

    P0140 O2SensorCircuitNoActivityDetected(Bank1Sensor2)

    P0141 O2SensorHeaterCircuitMalfunction(Bank1Sensor2)

    P0142 O2SensorCircuitMalfunction(Bank1Sensor3)

    P0143 O2SensorCircuitLowVoltage(Bank1Sensor3)

    P0144 O2SensorCircuitHighVoltage(Bank1Sensor3)

    P0145 O2SensorCircuitSlowResponse(Bank1Sensor3)

    P0146 O2SensorCircuitNoActivityDetected(Bank1Sensor3)

    P0147 O2SensorHeaterCircuitMalfunction(Bank1Sensor3)

    P0150 O2SensorCircuitMalfunction(Bank2Sensor1)

    P0151 O2SensorCircuitLowVoltage(Bank2Sensor1)

    P0152 O2SensorCircuitHighVoltage(Bank2Sensor1)

    P0153 O2SensorCircuitSlowResponse(Bank2Sensor1)

    P0154 O2SensorCircuitNoActivityDetected(Bank2Sensor1)

    P0155 O2SensorHeaterCircuitMalfunction(Bank2Sensor1)

    P0156 O2SensorCircuitMalfunction(Bank2Sensor2)

    P0157 O2SensorCircuitLowVoltage(Bank2Sensor2)

    P0158 O2SensorCircuitHighVoltage(Bank2Sensor2)

    P0159 O2SensorCircuitSlowResponse(Bank2Sensor2)

    P0160 O2SensorCircuitNoActivityDetected(Bank2Sensor2)

    P0161 O2SensorHeaterCircuitMalfunction(Bank2Sensor2)

    P0162 O2SensorCircuitMalfunction(Bank2Sensor3)

    P0163 O2SensorCircuitLowVoltage(Bank2Sensor3)

    P0164 O2SensorCircuitHighVoltage(Bank2Sensor3)

    P0165 O2SensorCircuitSlowResponse(Bank2Sensor3)

    P0166 O2SensorCircuitNoActivityDetected(Bank2Sensor3)

    P0167 O2SensorHeaterCircuitMalfunction(Bank2Sensor3)

    P0170 FuelTrimMalfunction(Bank1)

  • 110

    P0171 FuelTrimSystemLean(Bank1)

    P0172 FuelTrimtooRich(Bank1)

    P0173 FuelTrimMalfunction(Bank2)

    P0174 FuelTrimtooLean(Bank2)

    P0175 FuelTrimtooRich(Bank2)

    P0176 FuelCompositionSensorCircuitMalfunction

    P0177 FuelCompositionSensorCircuitRange/Performance

    P0178 FuelCompositionSensorCircuitLowInput

    P0179 FuelCompositionSensorCircuitHighInput

    P0180 FuelTemperatureSensorACircuitMalfunction

    P0181 FuelTemperatureSensorACircuitRange/Performance

    P0182 FuelTemperatureSensorACircuitLowInput

    P0183 FuelTemperatureSensorACircuitHighInput

    P0184 FuelTemperatureSensorACircuitIntermittent

    P0185 FuelTemperatureSensorBCircuitMalfunction

    P0186 FuelTemperatureSensorBCircuitRange/Performance

    P0187 FuelTemperatureSensorBCircuitLowInput

    P0188 FuelTemperatureSensorBCircuitHighInput

    P0189 FuelTemperatureSensorBCircuitIntermittent

    P0190 FuelRailPressureSensorCircuitMalfunction

    P0191 FuelRailPressureSensorCircuitRange/Performance

    P0192 FuelRailPressureSensorCircuitLowInput

    P0193 FuelRailPressureSensorCircuitHighInput

    P0194 FuelRailPressureSensorCircuitIntermittent

    P0195 EngineOilTemperatureSensorMalfunction

    P0196 EngineOilTemperatureSensorRange/Performance

    P0197 EngineOilTemperatureSensorLow

    P0198 EngineOilTemperatureSensorHigh

    P0199 EngineOilTemperatureSensorIntermittent

    P0200 InjectorCircuitMalfunction

    P0201 InjectorCircuitMalfunctionCylinder1

    P0202 InjectorCircuitMalfunctionCylinder2

    P0203 InjectorCircuitMalfunctionCylinder3

    P0204 InjectorCircuitMalfunctionCylinder4

    P0205 InjectorCircuitMalfunctionCylinder5

    P0206 InjectorCircuitMalfunctionCylinder6

    P0207 InjectorCircuitMalfunctionCylinder7

    P0208 InjectorCircuitMalfunctionCylinder8

    P0209 InjectorCircuitMalfunctionCylinder9

  • 111

    P0210 InjectorCircuitMalfunctionCylinder10

    P0211 InjectorCircuitMalfunctionCylinder11

    P0212 InjectorCircuitMalfunctionCylinder12

    P0213 ColdStartInjector1Malfunction

    P0214 ColdStartInjector2Malfunction

    P0215 EngineShutoffSolenoidMalfunction

    P0216 InjectionTimingControlCircuitMalfunction

    P0217 EngineOvertempCondition

    P0218 TransmissionOverTemperatureCondition

    P0219 EngineOverspeedCondition

    P0220 Throttle/PetalPositionSensor/SwitchBCircuitMalfunction

    P0221Throttle/PetalPositionSensor/SwitchBCircuitRange/Performance

    Problem

    P0222 Throttle/PetalPositionSensor/SwitchBCircuitLowInput

    P0223 Throttle/PetalPositionSensor/SwitchBCircuitHighInput

    P0224 Throttle/PetalPositionSensor/SwitchBCircuitIntermittent

    P0225 Throttle/PetalPositionSensor/SwitchCCircuitMalfunction

    P0226 Throttle/PetalPositionSensor/SwitchCCircuitRange/PerformanceProblem

    P0227 Throttle/PetalPositionSensor/SwitchCCircuitLowInput

    P0228 Throttle/PetalPositionSensor/SwitchCCircuitHighInput

    P0229 Throttle/PetalPositionSensor/SwitchCCircuitIntermittent

    P0230 FuelPumpPrimaryCircuitMalfunction

    P0231 FuelPumpSecondaryCircuitLow

    P0232 FuelPumpSecondaryCircuitHigh

    P0233 FuelPumpSecondaryCircuitIntermittent

    P0234 EngineOverboostCondition

    P0235 TurbochargerBoostSensorACircuitMalfunction

    P0236 TurbochargerBoostSensorACircuitRange/Performance

    P0237 TurbochargerBoostSensorACircuitLow

    P0238 TurbochargerBoostSensorACircuitHigh

    P0239 TurbochargerBoostSensorBMalfunction

    P0240 TurbochargerBoostSensorBCircuitRange/Performance

    P0241 TurbochargerBoostSensorBCircuitLow

    P0242 TurbochargerBoostSensorBCircuitHigh

    P0243 TurbochargerWastegateSolenoidAMalfunction

    P0244 TurbochargerWastegateSolenoidARange/Performance

    P0245 TurbochargerWastegateSolenoidALow

    P0246 TurbochargerWastegateSolenoidAHigh

    P0247 TurbochargerWastegateSolenoidBMalfunction

  • 112

    P0248 TurbochargerWastegateSolenoidBRange/Performance

    P0249 TurbochargerWastegateSolenoidBLow

    P0250 TurbochargerWastegateSolenoidBHigh

    P0251InjectionPumpFuelMeteringControlAMalfunction

    (Cam/Rotor/Injector)

    P0252InjectionPumpFuelMeteringControlARange/Performance

    (Cam/Rotor/Injector)

    P0253 InjectionPumpFuelMeteringControlALow(Cam/Rotor/Injector)

    P0254 InjectionPumpFuelMeteringControlAHigh(Cam/Rotor/Injector)

    P0255InjectionPumpFuelMeteringControlAIntermittent

    (Cam/Rotor/Injector)

    P0256InjectionPumpFuelMeteringControlBMalfunction

    (Cam/Rotor/Injector)

    P0257InjectionPumpFuelMeteringControlBRange/Performance

    (Cam/Rotor/Injector)

    P0258 InjectionPumpFuelMeteringControlBLow(Cam/Rotor/Injector)

    P0259 InjectionPumpFuelMeteringControlBHigh(Cam/Rotor/Injector)

    P0260 InjectionPumpFuelMeteringControlBIntermittent(Cam/Rotor/Injector)

    P0261 Cylinder1InjectorCircuitLow

    P0262 Cylinder1InjectorCircuitHigh

    P0263 Cylinder1Contribution/BalanceFault

    P0264 Cylinder2InjectorCircuitLow

    P0265 Cylinder2InjectorCircuitHigh

    P0266 Cylinder2Contribution/BalanceFault

    P0267 Cylinder3InjectorCircuitLow

    P0268 Cylinder3InjectorCircuitHigh

    P0269 Cylinder3Contribution/BalanceFault

    P0270 Cylinder4InjectorCircuitLow

    P0271 Cylinder4InjectorCircuitHigh

    P0272 Cylinder4Contribution/BalanceFault

    P0273 Cylinder5InjectorCircuitLow

    P0274 Cylinder5InjectorCircuitHigh

    P0275 Cylinder5Contribution/BalanceFault

    P0276 Cylinder6InjectorCircuitLow

    P0277 Cylinder6InjectorCircuitHigh

    P0278 Cylinder6Contribution/BalanceFault

    P0279 Cylinder7InjectorCircuitLow

    P0280 Cylinder7InjectorCircuitHigh

  • 113

    P0281 Cylinder7Contribution/BalanceFault

    P0282 Cylinder8InjectorCircuitLow

    P0283 Cylinder8InjectorCircuitHigh

    P0284 Cylinder8Contribution/BalanceFault

    P0285 Cylinder9InjectorCircuitLow

    P0286 Cylinder9InjectorCircuitHigh

    P0287 Cylinder9Contribution/BalanceFault

    P0288 Cylinder10InjectorCircuitLow

    P0289 Cylinder10InjectorCircuitHigh

    P0290 Cylinder10Contribution/BalanceFault

    P0291 Cylinder11InjectorCircuitLow

    P0292 Cylinder11InjectorCircuitHigh

    P0293 Cylinder11Contribution/BalanceFault

    P0294 Cylinder12InjectorCircuitLow

    P0295 Cylinder12InjectorCircuitHigh

    P0296 Cylinder12Contribution/RangeFault

    P0300 Random/MultipleCylinderMisfireDetected

    P0301 Cylinder1MisfireDetected

    P0302 Cylinder2MisfireDetected

    P0303 Cylinder3MisfireDetected

    P0304 Cylinder4MisfireDetected

    P0305 Cylinder5MisfireDetected

    P0306 Cylinder6MisfireDetected

    P0307 Cylinder7MisfireDetected

    P0308 Cylinder8MisfireDetected

    P0309 Cylinder9MisfireDetected

    P0310 Cylinder10MisfireDetected

    P0311 Cylinder11MisfireDetected

    P0312 Cylinder12MisfireDetected

    P0320 Ignition/DistributorEngineSpeedInputCircuitMalfunction

    P0321 Ignition/DistributorEngineSpeedInputCircuitRange/Performance

    P0322 Ignition/DistributorEngineSpeedInputCircuitNoSignal

    P0323 Ignition/DistributorEngineSpeedInputCircuitIntermittent

    P0325 KnockSensor1CircuitMalfunction(Bank1orSingleSensor)

    P0326 KnockSensor1CircuitRange/Performance(Bank1orSingleSensor)

    P0327 KnockSensor1CircuitLowInput(Bank1orSingleSensor)

    P0328 KnockSensor1CircuitHighInput(Bank1orSingleSensor)

    P0329 KnockSensor1CircuitIntermittent(Bank1orSingleSensor)

    P0330 KnockSensor2CircuitMalfunction(Bank2)

  • 114

    P0331 KnockSensor2CircuitRange/Performance(Bank2)

    P0332 KnockSensor2CircuitLowInput(Bank2)

    P0333 KnockSensor2CircuitHighInput(Bank2)

    P0334 KnockSensor2CircuitIntermittent(Bank2)

    P0335 CrankshaftPositionSensorACircuitMalfunction

    P0336 CrankshaftPositionSensorACircuitRange/Performance

    P0337 CrankshaftPositionSensorACircuitLowInput

    P0338 CrankshaftPositionSensorACircuitHighInput

    P0339 CrankshaftPositionSensorACircuitIntermittent

    P0340 CamshaftPositionSensorCircuitMalfunction

    P0341 CamshaftPositionSensorCircuitRange/Performance

    P0342 CamshaftPositionSensorCircuitLowInput

    P0343 CamshaftPositionSensorCircuitHighInput

    P0344 CamshaftPositionSensorCircuitIntermittent

    P0350 IgnitionCoilPrimary/SecondaryCircuitMalfunction

    P0351 IgnitionCoilAPrimary/SecondaryCircuitMalfunction

    P0352 IgnitionCoilBPrimary/SecondaryCircuitMalfunction

    P0353 IgnitionCoilCPrimary/SecondaryCircuitMalfunction

    P0354 IgnitionCoilDPrimary/SecondaryCircuitMalfunction

    P0355 IgnitionCoilEPrimary/SecondaryCircuitMalfunction

    P0356 IgnitionCoilFPrimary/SecondaryCircuitMalfunction

    P0357 IgnitionCoilGPrimary/SecondaryCircuitMalfunction

    P0358 IgnitionCoilHPrimary/SecondaryCircuitMalfunction

    P0359 IgnitionCoilIPrimary/SecondaryCircuitMalfunction

    P0360 IgnitionCoilJPrimary/SecondaryCircuitMalfunction

    P0361 IgnitionCoilKPrimary/SecondaryCircuitMalfunction

    P0362 IgnitionCoilLPrimary/SecondaryCircuitMalfunction

    P0370 TimingReferenceHighResolutionSignalAMalfunction

    P0371 TimingReferenceHighResolutionSignalATooManyPulses

    P0372 TimingReferenceHighResolutionSignalATooFewPulses

    P0373 TimingReferenceHighResolutionSignalAIntermittent/ErraticPulses

    P0374 TimingReferenceHighResolutionSignalANoPulses

    P0375 TimingReferenceHighResolutionSignalBMalfunction

    P0376 TimingReferenceHighResolutionSignalBTooManyPulses

    P0377 TimingReferenceHighResolutionSignalBTooFewPulses

    P0378 TimingReferenceHighResolutionSignalBIntermittent/ErraticPulses

    P0379 TimingReferenceHighResolutionSignalBNoPulses

    P0380 GlowPlug/HeaterCircuitAMalfunction

  • 115

    P0381 GlowPlug/HeaterIndicatorCircuitMalfunction

    P0382 ExhaustGasRecirculationFlowMalfunction

    P0385 CrankshaftPositionSensorBCircuitMalfunction

    P0386 CrankshaftPositionSensorBCircuitRange/Performance

    P0387 CrankshaftPositionSensorBCircuitLowInput

    P0388 CrankshaftPositionSensorBCircuitHighInput

    P0389 CrankshaftPositionSensorBCircuitIntermittent

    P0400 ExhaustGasRecirculationFlowMalfunction

    P0401 ExhaustGasRecirculationFlowInsufficientDetected

    P0402 ExhaustGasRecirculationFlowExcessiveDetected

    P0403 ExhaustGasRecirculationCircuitMalfunction

    P0404 ExhaustGasRecirculationCircuitRange/Performance

    P0405 ExhaustGasRecirculationSensorACircuitLow

    P0406 ExhaustGasRecirculationSensorACircuitHigh

    P0407 ExhaustGasRecirculationSensorBCircuitLow

    P0408 ExhaustGasRecirculationSensorBCircuitHigh

    P0410 SecondaryAirInjectionSystemMalfunction

    P0411 SecondaryAirInjectionSystemIncorrectFlowDetected

    P0412 SecondaryAirInjectionSystemSwitchingValveACircuitMalfunction

    P0413 SecondaryAirInjectionSystemSwitchingValveACircuitOpen

    P0414 SecondaryAirInjectionSystemSwitchingValveACircuitShorted

    P0415 SecondaryAirInjectionSystemSwitchingValveBCircuitMalfunction

    P0416 SecondaryAirInjectionSystemSwitchingValveBCircuitOpen

    P0417 SecondaryAirInjectionSystemSwitchingValveBCircuitShorted

    P0418 SecondaryAirInjectionSystemRelayACircuitMalfunction

    P0419 SecondaryAirInjectionSystemRelayBCircuitMalfunction

    P0420 CatalystSystemEfficiencyBelowThreshold(Bank1)

    P0421 WarmUpCatalystEfficiencyBelowThreshold(Bank1)

    P0422 MainCatalystEfficiencyBelowThreshold(Bank1)

    P0423 HeatedCatalystEfficiencyBelowThreshold(Bank1)

    P0424 HeatedCatalystTemperatureBelowThreshold(Bank1)

    P0426 CatalystTemperatureSensorRange/Performance(Bank1)

    P0427 CatalystTemperatureSensorLowInput(Bank1)

    P0428 CatalystTemperatureSensorHighInput(Bank1)

    P0430 CatalystSystemEfficiencyBelowThreshold(Bank2)

    P0431 WarmUpCatalystEfficiencyBelowThreshold(Bank2)

    P0432 MainCatalystEfficiencyBelowThreshold(Bank2)

    P0433 HeatedCatalystEfficiencyBelowThreshold(Bank2)

  • 116

    P0434 HeatedCatalystTemperatureBelowThreshold(Bank2)

    P0436 CatalystTemperatureSensorRange/Performance(Bank2)

    P0437 CatalystTemperatureSensorLowInput(Bank2)

    P0438 CatalystTemperatureSensorHighInput(Bank2)

    P0440 EvaporativeEmissionControlSystemMalfunction

    P0441 EvaporativeEmissionControlSystemIncorrectPurgeFlow

    P0442 EvaporativeEmissionControlSystemLeakDetected(smallleak)

    P0443EvaporativeEmissionControlSystemPurgeControlValveCircuit

    Malfunction

    P0444 EvaporativeEmissionControlSystemPurgeControlValveCircuitOpen

    P0445EvaporativeEmissionControlSystemPurgeControlValveCircuit

    Shorted

    P0446 EvaporativeEmissionControlSystemVentControlCircuitMalfunction

    P0447 EvaporativeEmissionControlSystemVentControlCircuitOpen

    P0448 EvaporativeEmissionControlSystemVentControlCircuitShorted

    P0449 EvaporativeEmissionControlSystemVentValve/SolenoidCircuitMalfunction

    P0450 EvaporativeEmissionControlSystemPressureSensorMalfunction

    P0451 EvaporativeEmissionControlSystemPressureSensorRange/Performance

    P0452 EvaporativeEmissionControlSystemPressureSensorLowInput

    P0453 EvaporativeEmissionControlSystemPressureSensorHighInput

    P0454 EvaporativeEmissionControlSystemPressureSensorIntermittent

    P0455 EvaporativeEmissionControlSystemLeakDetected(grossleak)

    P0460 FuelLevelSensorCircuitMalfunction

    P0461 FuelLevelSensorCircuitRange/Performance

    P0462 FuelLevelSensorCircuitLowInput

    P0463 FuelLevelSensorCircuitHighInput

    P0464 FuelLevelSensorCircuitIntermittent

    P0465 PurgeFlowSensorCircuitMalfunction

    P0466 PurgeFlowSensorCircuitRange/Performance

    P0467 PurgeFlowSensorCircuitLowInput

    P0468 PurgeFlowSensorCircuitHighInput

    P0469 PurgeFlowSensorCircuitIntermittent

    P0470 ExhaustPressureSensorMalfunction

    P0471 ExhaustPressureSensorRange/Performance

    P0472 ExhaustPressureSensorLow

  • 117

    P0473 ExhaustPressureSensorHigh

    P0474 ExhaustPressureSensorIntermittent

    P0475 ExhaustPressureControlValveMalfunction

    P0476 ExhaustPressureControlValveRange/Performance

    P0477 ExhaustPressureControlValveLow

    P0478 ExhaustPressureControlValveHigh

    P0479 ExhaustPressureControlValveIntermittent

    P0480 CoolingFan1ControlCircuitMalfunction

    P0481 CoolingFan2ControlCircuitMalfunction

    P0482 CoolingFan3ControlCircuitMalfunction

    P0483 CoolingFanRationalityCheckMalfunction

    P0484 CoolingFanCircuitOverCurrent

    P0485 CoolingFanPower/GroundCircuitMalfunction

    P0500 VehicleSpeedSensorMalfunction

    P0501 VehicleSpeedSensorRange/Performance

    P0502 VehicleSpeedSensorLowInput

    P0503 VehicleSpeedSensorIntermittent/Erratic/High

    P0505 IdleControlSystemMalfunction

    P0506 IdleControlSystemRPMLowerThanExpected

    P0507 IdleControlSystemRPMHigherThanExpected

    P0510 ClosedThrottlePositionSwitchMalfunction

    P0520 EngineOilPressureSensor/SwitchCircuitMalfunction

    P0521 EngineOilPressureSensor/SwitchCircuitRange/Performance

    P0522 EngineOilPressureSensor/SwitchCircuitLowVoltage

    P0523 EngineOilPressureSensor/SwitchCircuitHighVoltage

    P0530 A/CRefrigerantPressureSensorCircuitMalfunction

    P0531 A/CRefrigerantPressureSensorCircuitRange/Performance

    P0532 A/CRefrigerantPressureSensorCircuitLowInput

    P0533 A/CRefrigerantPressureSensorCircuitHighInput

    P0534 AirConditionerRefrigerantChargeLoss

    P0550 PowerSteeringPressureSensorCircuitMalfunction

    P0551 PowerSteeringPressureSensorCircuitRange/Performance

    P0552 PowerSteeringPressureSensorCircuitLowInput

    P0553 PowerSteeringPressureSensorCircuitHighInput

    P0554 PowerSteeringPressureSensorCircuitIntermittent

    P0560 SystemVoltageMalfunction

    P0561 SystemVoltageUnstable

    P0562 SystemVoltageLow

    P0562 A/Cpressuresensorlowvoltage(Chrysler)

  • 118

    P0563 SystemVoltageHigh

    P0565 CruiseControlOnSignalMalfunction

    P0566 CruiseControlOffSignalMalfunction

    P0567 CruiseControlResumeSignalMalfunction

    P0568 CruiseControlSetSignalMalfunction

    P0569 CruiseControlCoastSignalMalfunction

    P0570 CruiseControlAccelSignalMalfunction

    P0571 CruiseControl/BrakeSwitchACircuitMalfunction

    P0572 CruiseControl/BrakeSwitchACircuitLow

    P0573 CruiseControl/BrakeSwitchACircuitHigh

    P0574 CruiseControlRelatedMalfunction

    P0575 CruiseControlRelatedMalfunction

    P0576 CruiseControlRelatedMalfunction

    P0576 CruiseControlRelatedMalfunction

    P0578 CruiseControlRelatedMalfunction

    P0579 CruiseControlRelatedMalfunction

    P0580 CruiseControlRelatedMalfunction

    P0600 SerialCommunicationLinkMalfunction

    P0601 ControlModuleReadOnlyMemory(ROM)

    P0602 ControlModuleProgrammingError

    P0603 InternalControlModuleKeepAliveMemory(KAM)Error

    P0604 InternalControlModuleRandomAccessMemory(RAM)Error

    P0605 InternalControlModuleReadOnlyMemory(ROM)Error

    P0606 PCMProcessorFault

    P0608 ControlModuleVSSOutputAMalfunction

    P0609 ControlModuleVSSOutputBMalfunction

    P0620 GeneratorControlCircuitMalfunction

    P0621 GeneratorLampLControlCircuitMalfunction

    P0622 GeneratorFieldFControlCircuitMalfunction

    P0650 MalfunctionIndicatorLamp(MIL)ControlCircuitMalfunction

    P0654 EngineRPMOutputCircuitMalfunction

    P0655 EngineHotLampOutputControlCircuitMalfucntion

    P0656 FuelLevelOutputCircuitMalfunction

    P0700 TransmissionControlSystemMalfunction

    P0701 TransmissionControlSystemRange/Performance

    P0702 TransmissionControlSystemElectrical

    P0703 TorqueConverter/BrakeSwitchBCircuitMalfunction

    P0704 ClutchSwitchInputCircuitMalfunction

    P0705 TransmissionRangeSensorCircuitmalfunction(PRNDLInput)

  • 119

    P0706 TransmissionRangeSensorCircuitRange/Performance

    P0707 TransmissionRangeSensorCircuitLowInput

    P0708 TransmissionRangeSensorCircuitHighInput

    P0709 TransmissionRangeSensorCircuitIntermittent

    P0710 TransmissionFluidTemperatureSensorCircuitMalfunction

    P0711 TransmissionFluidTemperatureSensorCircuitRange/Performance

    P0712 TransmissionFluidTemperatureSensorCircuitLowInput

    P0713 TransmissionFluidTemperatureSensorCircuitHighInput

    P0714 TransmissionFluidTemperatureSensorCircuitIntermittent

    P0715 Input/TurbineSpeedSensorCircuitMalfunction

    P0716 Input/TurbineSpeedSensorCircuitRange/Performance

    P0717 Input/TurbineSpeedSensorCircuitNoSignal

    P0718 Input/TurbineSpeedSensorCircuitIntermittent

    P0719 TorqueConverter/BrakeSwitchBCircuitLow

    P0720 OutputSpeedSensorCircuitMalfunction

    P0721 OutputSpeedSensorRange/Performance

    P0722 OutputSpeedSensorNoSignal

    P0723 OutputSpeedSensorIntermittent

    P0724 TorqueConverter/BrakeSwitchBCircuitHigh

    P0725 EngineSpeedinputCircuitMalfunction

    P0726 EngineSpeedInputCircuitRange/Performance

    P0727 EngineSpeedInputCircuitNoSignal

    P0728 EngineSpeedInputCircuitIntermittent

    P0730 IncorrectGearRatio

    P0731 Gear1Incorrectratio

    P0732 Gear2Incorrectratio

    P0733 Gear3Incorrectratio

    P0734 Gear4Incorrectratio

    P0735 Gear5Incorrectratio

    P0736 Reverseincorrectgearratio

    P0740 TorqueConverterClutchCircuitMalfuction

    P0741 TorqueConverterClutchCircuitPerformanceorStuckOff

    P0742 TorqueConverterClutchCircuitStuckOn

    P0743 TorqueConverterClutchCircuitElectrical

    P0744 TorqueConverterClutchCircuitIntermittent

    P0745 PressureControlSolenoidMalfunction

    P0746 PressureControlSolenoidPerformanceorStuckOff

    P0747 PressureControlSolenoidStuckOn

    P0748 PressureControlSolenoidElectrical

  • 120

    P0749 PressureControlSolenoidIntermittent

    P0750 ShiftSolenoidAMalfunction

    P0751ShiftSolenoidAPerformanceorStuckOff/

    12ShiftSolenoidValvePerformance

    P0752 ShiftSolenoidAStuckOn

    P0753ShiftSolenoidAElectrical/

    12ShiftSolenoidCircuitElectrical

    P0754 ShiftSolenoidAIntermittent

    P0755 ShiftSolenoidBMalfunction

    P0756ShiftSolenoidBPerformanceorStuckOff/

    23ShiftSolenoidValvePerformance

    P0757 ShiftSolenoidBStuckOn

    P0758 ShiftSolenoidBElectrical/23ShiftSolenoidCircuitElectrical

    P0759 ShiftSolenoidBIntermittent

    P0760 ShiftSolenoidCMalfunction

    P0761 ShiftSolenoidCPerformanceorStuckOff

    P0762 ShiftSolenoidCStuckOn

    P0763 ShiftSolenoidCElectrical

    P0764 ShiftSolenoidCIntermittent

    P0765 ShiftSolenoidDMalfunction

    P0766 ShiftSolenoidDPerformanceorStuckOff

    P0767 ShiftSolenoidDStuckOn

    P0768 ShiftSolenoidDElectrical

    P0769 ShiftSolenoidDIntermittent

    P0770 ShiftSolenoidEMalfunction

    P0771 ShiftSolenoidEPerformanceorStuckOff

    P0772 ShiftSolenoidEStuckOn

    P0773 ShiftSolenoidEElectrical

    P0774 ShiftSolenoidEIntermittent

    P0775 PressureControlSolenoidBMalfunction

    P0776 PressureControlSolenoidBPerformance

    P0777 PressureControlSolenoidBStuckOn

    P0778 PressureControlSolenoidBElectrical

    P0779 PressureControlSolenoidBIntermittent

    P0780 ShiftMalfunction

    P0781 12ShiftMalfunction

    P0782 23ShiftMalfunction

    P0783 34ShiftMalfunction

    P0784 45ShiftMalfunction

    P0785 Shift/TimingSolenoidMalfunction/32ShiftSolenoidCircuitElectrical

  • 121

    P0786 Shift/TimingSolenoidRange/Performance

    P0787 Shift/TimingSolenoidLow

    P0788 Shift/TimingSolenoidHigh

    P0789 Shift/TimingSolenoidIntermittent

    P0790 Normal/PerformanceSwitchCircuitMalfunction

    P0801 ReverseInhibitControlCircuitMalfunction

    P0803 14Upshift(SkipShift)SolenoidControlCircuitMalfunction

    P0804 14Upshift(SkipShift)LampControlCircuitMalfunction

    P1100 MAFSensorIntermittent/CheckofallOBDIISystemsNotComplete

    P1101MAFSensorOutOfSelfTestRange./

    KOERNotAbleToCompleteKOERAborted

    P1102 MAFSensorInRangeButLowerThanExpected

    P1103 MAFSensorInRangeButHigherThanExpected

    P1104 MAFGroundMalfunction

    P1105 DualAlternatorUpperFault

    P1106DualAlternatorLowerFault/ManifoldAbsolutePressure(MAP)Sensor

    CircuitIntermittentHighVoltage

    P1107 DualAlternatorLowerCircuitMalfunction/ManifoldAbsolutePressure(MAP)SensorC