Members Login
Username 
 
Password 
    Remember Me  
Post Info TOPIC: Gear indicator


Newbie

Status: Offline
Posts: 1
Date:
Gear indicator


Hy to everybody!
I've recently bougth a kawasaki z750 (2006 model), and I'd like to create a Gear Indicator. The idea is to use a microcontroller (+ 7 segment display) and connect it directly to the ECU. I've looked in a lot of forums trying to find any useful informations, but I didn't find anything.
So here's my questions:
1) is it possibile to read current gear from the ECU?
2) what is the protocol of communication?
3) is there any project similar to the one i'm looking for?
Thanks in advance,

Settuz


__________________
Settuz


Newbie

Status: Offline
Posts: 2
Date:

Hello there,

I used to own a Z750 and I now own a ZX12 on which I have a Gear Indicator that gets
"gear info" form the bikes gear position sensor (in parallel with the ECU)

Unfortunately there is no way (that i know of) to get the gear position out of the bike,
because as far as I know, there is no gear position switch on the Z750 06'...


__________________
MXP


Veteran Member

Status: Offline
Posts: 28
Date:

Hi!

 

Look at here for the answer to your question about PROTOCOL:

http://ecuhacking.activeboard.com/t56234221/kds-protocol/

Good Luck!



__________________
MXP


Veteran Member

Status: Offline
Posts: 28
Date:

Here my prototype working:

 

https://www.youtube.com/watch?v=2n8a3q9olTw

 

Bye



__________________
MXP


Veteran Member

Status: Offline
Posts: 28
Date:

See below.



-- Edited by MXP on Monday 17th of February 2014 11:53:12 AM

__________________
MXP


Veteran Member

Status: Offline
Posts: 28
Date:

Hello.

Here you can find FIRMWARE and HARDWARE of the small prototype I developed to get TEMP and GEAR INDICATOR (there is a small pushbutton to change the function).

The project can be improved removing the external xtal and using the internal 8 MHz oscillator of the PIC but I had no more spare time to "play" on it... (if you are planning to build it let me know, maybe I can help you).

I tested it on my bike as you can see from this short (and ugly) video and it seems to work fine: http://www.youtube.com/watch?v=2n8a3q9olTw

My bike is a Z750R 2011 but it should work on all these models:

ZX-6R (2010/2012)
ZX-10R (2010/2012)
ER-6 N/F (2010-2012),
Ninja 250R [FI model only] (2010-2012)
Ninja 400R (2011)
ZRX1200 DAEG (2010-2012)
Vulcan 900 / VN900 (2010-2012)
Vulcan 2000 / VN2000 (2010-2012)
KFX450R [ATV] (2010-2012)
KVF 750 [ATV] (2010-2011)
ER-6 N/F (2012),
Ninja 650R (2012),
KLE650 (2010-2012),
Versys 600 (2010-2012),
Versys 1000 (2012)
Z750 (2010-2012),
Z750R (2011-2012),
Z1000 (2010-2012),
ZZR 1400 (2010/2012 )
ZZR 250 Ninja (2012)
Ninja 1000 / Z1000SX (2011- 2012),
ZRX1200 DAEG (2011-2012),
W800 (2011-2012)
GTR 1400 (2011/2012)

 

Enjoy yourself!! wink

 

********* START OF HEADER FILE *******

#include <p18f2420.h>

// COSTANTI DI SISTEMA

#define    BIT0    0x01
#define    BIT1    0x02
#define    BIT2    0x04
#define    BIT3    0x08
#define    BIT4    0x10
#define    BIT5    0x20
#define    BIT6    0x40
#define    BIT7    0x80

#define GEAR_MODE    0
#define    TEMP_MODE    1

// K-BUS

#define    K_HIGH        (LATC |= BIT6)
#define    K_LOW        (LATC &= ~BIT6)

#define    BUTTON        (PORTE & BIT3)

// KWP2000

#define frame        (unsigned char)0x80
#define target        (unsigned char)0x11
#define source         (unsigned char)0xF1
#define leng         (unsigned char)0x02
#define    service     (unsigned char)0x21
****** END OF HEADER FILE *********

 

***** START OF SOURCE CODE *****

#include <p18f2420.h>
#include <usart.h>
#include "../h/definizioni.h"

#define        N        64

unsigned char START_COMM_MSG[5] =     {0x81,0x11,0xF1,0x81,0x04};
unsigned char START_DIAG_MSG[7] =     {0x80,0x11,0xF1,0x02,0x10,0x80,0x14};
unsigned char READ_TEMP_MSG[7] =     {0x80,0x11,0xF1,0x02,0x21,0x06,0xAB};
unsigned char READ_GEAR_MSG[7] =     {0x80,0x11,0xF1,0x02,0x21,0x0B,0xB0};

//                                0        1        2        3        4        5        6        7        8        9        -       
unsigned char DISPLAY[11] = {    0x3F,    0x06,    0x5B,    0x4F,    0x66,    0x6D,    0x7D,    0x07,    0x7F,    0x6F,    0x40};

unsigned char rx_buffer[N];

int ADC = 0;
int TEMP = 0;
unsigned char GEAR = 0;

char MODE = TEMP_MODE;

void InitSystem(void)
{
    OSCCON = 0b01110000;
   
    LATA = 0;
    LATB = 0;
    LATC = 0;

    PORTA = 0;
    PORTB = 0;
    PORTC = 0;
   
    TRISA = 0;
    TRISB = 0;
    TRISC = 0;
   
    TMR0H = 0;
    TMR0L = 0;
   
    ADCON0 = 0;
    ADCON1 = 0x0F;
    ADCON2 = 0;

    CMCONbits.CM = 7;
   
    PIR1bits.RCIF = 0;
    PIE1bits.RCIE = 1;
    INTCONbits.PEIE = 1;
}

void InterruptHandler(void);

#pragma code InterruptVector = 0x08
void InterruptVector (void)
{
  _asm
    goto InterruptHandler
  _endasm
}

#pragma code
#pragma interrupt InterruptHandler

void InterruptHandler (void)
{
    if (INTCONbits.TMR0IF)                                       
    {  
        INTCONbits.TMR0IF = 0;                   
    }
   
    else
   
    if(PIR1bits.RCIF)                        // RX da K-BUS   
    {
        rx_buffer[9] = rx_buffer[8];
        rx_buffer[8] = rx_buffer[7];
        rx_buffer[7] = rx_buffer[6];
        rx_buffer[6] = rx_buffer[5];
        rx_buffer[5] = rx_buffer[4];
        rx_buffer[4] = rx_buffer[3];
        rx_buffer[3] = rx_buffer[2];
        rx_buffer[2] = rx_buffer[1];
        rx_buffer[1] = rx_buffer[0];
        rx_buffer[0] = ReadUSART();
       
        PIR1bits.RCIF = 1;
    }
}

void Ritardo(unsigned int r)
{   
    unsigned int i = 0;

    for(i=0;i<r;i++);
}

void Pulse25ms(void)
{
    K_HIGH;
    Ritardo(65000);
    Ritardo(65000);
    Ritardo(65000);
    Ritardo(65000);
    Ritardo(65000);
           
    K_LOW;
    Ritardo(11900);
       
    K_HIGH;
    Ritardo(11900);
}

void InitSerial(void)
{
    TRISC = 0xC0;
                   
    OpenUSART(     USART_TX_INT_OFF &
                USART_RX_INT_ON &
                USART_ASYNCH_MODE &
                USART_EIGHT_BIT &
                USART_CONT_RX &
                USART_BRGH_HIGH,
                239);                    // 10417 Baud
}

void SendMSG(unsigned char * MSG, unsigned char len)
{
    unsigned char i = 0;

    for(i=0;i<len;i++)
    {
        while(BusyUSART());   
        WriteUSART(MSG);
    }
}

void ReadValue(unsigned char address)
{
    unsigned char checksum = 0;

    checksum = frame + target + source + leng + service + address;

    while(BusyUSART());    WriteUSART(frame);
    while(BusyUSART());    WriteUSART(target);
    while(BusyUSART());    WriteUSART(source);
    while(BusyUSART());    WriteUSART(leng);
    while(BusyUSART());    WriteUSART(service);
    while(BusyUSART());    WriteUSART(address);
    while(BusyUSART());    WriteUSART(checksum);
}

void CalcolaTEMP(void)
{   
    ADC = rx_buffer[1];
    TEMP = (ADC - (int)48)/1.6;   
}

void CalcolaGEAR(void)
{
    GEAR = rx_buffer[1];
}

void VisualTEMP(void)
{
    unsigned char unita = 0;
    unsigned char decine = 0;
   
    unita = ((TEMP & 0x00FF))%10;
    decine  = ((TEMP & 0x00FF)/10)%10;

    if(TEMP<40) // TEMP < 40°C
    {
        LATA = 0x38;            // "L"
        LATB = 0x5C;            // "o"
        LATCbits.LATC0 = 0;
    }
   
    else
   
    if(TEMP>99) // TEMP >= 100°C   
    {   
        LATA = 0x76;    // "H"
        LATB = 0x04;    // "i"
        LATCbits.LATC0 = 1;
    }
   
    else        // 40°C <= TEMP < 100 °C
    {
        LATA = DISPLAY[decine];
        LATB = DISPLAY[unita];
        if(DISPLAY[decine] & 0x40) LATCbits.LATC0 = 1; else LATCbits.LATC0 = 0;
    }
}

void VisualGEAR(void)
{
    LATA = 0;       
    LATCbits.LATC0 = 0;

    if(GEAR==0)
        LATB = 0x40;
    else
        LATB = DISPLAY[GEAR%10];
}

void HandleButton(void)
{
    if(BUTTON==0)
    {
        if(MODE==TEMP_MODE) MODE = GEAR_MODE; else MODE = TEMP_MODE;
        while(BUTTON==0);
        Ritardo(65000);
    }
}

void RequestTemp(void)
{
    ReadValue(0x06);           
           
    Ritardo(65000);
    Ritardo(65000);
    CalcolaTEMP();
    VisualTEMP();
}

void RequestGear(void)
{
    ReadValue(0x0B);           
       
    Ritardo(65000);
    Ritardo(65000);
    CalcolaGEAR();
    VisualGEAR();
}

void main(void)
{   
    InitSystem();
    Ritardo(65000);
    Ritardo(65000);
   
    Pulse25ms();
   
    InitSerial();
   
    INTCONbits.GIE = 1;
   
    SendMSG(START_COMM_MSG,5);    Ritardo(65000);
    SendMSG(START_DIAG_MSG,7);    Ritardo(65000);
   
    LATB = 0x40;
    LATA = 0;       
    LATCbits.LATC0 = 1;
   
    Ritardo(65000);
   
    while(1)
    {
        HandleButton();
       
        if(MODE==TEMP_MODE) RequestTemp(); else RequestGear();
    }
}

******* END OF SOURCE CODE ******

 

 



-- Edited by MXP on Tuesday 18th of February 2014 05:58:51 PM

Attachments
__________________


Guru

Status: Offline
Posts: 963
Date:

Good job.

Kawasaki uses ECUs manufactured by both Denso and Mitsubishi. I know all the Densos I've seen use the above protocol. But have you tried it on any Mitsubishi equipped Kawis?

In other words is this a kawasaki protocol or a Denso one?

__________________


Newbie

Status: Offline
Posts: 4
Date:

Hi,

I tryed to see your videos but they have been removed, do you have them?

Do you think your sistem could work also for yamaha bikes?

Thanks



__________________
MXP


Veteran Member

Status: Offline
Posts: 28
Date:

RidgeRacer wrote:

Good job.

Kawasaki uses ECUs manufactured by both Denso and Mitsubishi. I know all the Densos I've seen use the above protocol. But have you tried it on any Mitsubishi equipped Kawis?

In other words is this a kawasaki protocol or a Denso one?


 

Thank you.

That's a good question however I had no opportunities to verify the prototype on different models of kawasaki equipped with Mitsubishi ECUs.

Bye



-- Edited by MXP on Tuesday 25th of February 2014 05:16:04 PM

__________________
MXP


Veteran Member

Status: Offline
Posts: 28
Date:

TDMAPP wrote:

Hi,

I tryed to see your videos but they have been removed, do you have them?

Do you think your sistem could work also for yamaha bikes?

Thanks


 

Hi

Yes, sorry I removed the video because it was ugly! blankstare

No, I don't think it can work on Yamaha bikes.



-- Edited by MXP on Tuesday 25th of February 2014 05:17:37 PM

__________________
MXP


Veteran Member

Status: Offline
Posts: 28
Date:

.

 



-- Edited by MXP on Wednesday 26th of February 2014 10:12:31 AM

__________________


Newbie

Status: Offline
Posts: 4
Date:

smile Ok, thanks, no problems



__________________
Page 1 of 1  sorted by
 
Quick Reply

Please log in to post quick replies.

Tweet this page Post to Digg Post to Del.icio.us


Create your own FREE Forum
Report Abuse
Powered by ActiveBoard