View Single Post
Old 10-08-2010, 04:23 AM   #598 (permalink)
priit271
EcoModding Lurker
 
Join Date: Oct 2010
Location: Estonia
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
I tried all of them and not work. With voltmeter in K line pin sometime 12v then go's 0v etc.
I found sample init code for kwp1281:
The 5 baud is done using bit bashing technique. A 0x01 is required and each bit is 1/5 second long (200mS). Here is the function :-

char diag_l0_initbus(void)
{

TRISC6 = 0; //Set RC6 as output
//Now we need to sent address of 0x01 at 5 baud

OBD_K_LINE = 0;

DelayMs(200);

OBD_K_LINE = 1;

DelayMs(200);

OBD_K_LINE = 0;

DelayMs(200); //A high of 1400mS
DelayMs(200);
DelayMs(200);
DelayMs(200);
DelayMs(200);
DelayMs(200);
DelayMs(200);

OBD_K_LINE = 1;

//Now config serial port
SPBRG=29; // data rate for sending/receiving @ 10400 baud
BRGH=0; // data rate for sending/receiving
SYNC=0; // asynchronous
SPEN=1; // enable serial port pins
CREN=1; // enable reception
SREN=0; // no effect
TXIE=0; // disable tx interrupts
RCIE=0; // disable rx interrupts
TX9=0; // 8-bit transmission
RX9=0; // 8-bit reception
TXEN=1; // enable the transmitter

}

Now I need somebody to edit obduino32 init code. I'm not good in C

Last edited by priit271; 10-08-2010 at 09:21 AM.. Reason: add code
  Reply With Quote