EngineersGarage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise
You are here: Home / Topics / Motorbike cockpit (km/h, odometer, fuel gauge, bat level,RTC) using C52

Motorbike cockpit (km/h, odometer, fuel gauge, bat level,RTC) using C52

|

Microcontroller › 8051 › Motorbike cockpit (km/h, odometer, fuel gauge, bat level,RTC) using C52

  • This topic has 30 replies, 6 voices, and was last updated 11 years, 2 months ago by lakshmeesha.
Viewing 15 posts - 1 through 15 (of 31 total)
1 2 3 →
  • Author
    Posts
  • May 13, 2013 at 8:02 pm #2402
    lakshmeesha
    Participant

    hello,

     

    i don’t have that much programming baground, im having MCA in this sem oly. however, i’m going to do Digital Cockpit for bike, it have to show speed, distence, fuel gauge, battery level and Time In 128*64 GLCD display

     

     

    im having a plan like this

     

    1) speedometer & distence meter : hall sensor

    2) RTC : DS—- something

    3)fuel and battery meter : ADC

    >>im not able reach initial stage also : counting input pulse per second and showing it in LCD display :( 

     

    code is:

     

     

     #include<reg52.h>
     #include<stdio.h>
     #include<math.h>
    #define cmdport P1
    #define dataport P2
    #define pulse P3
    #define op P0
    #define q 100
    sbit rs = cmdport^0;  //register select pin
    sbit rw = cmdport^1;  // read write pin
    sbit e = cmdport^2;  //enable pin
    sbit n = pulse^4;
    sbit rst= pulse^1; 
     
    void delay(unsigned int msec)  // Function to provide time delay in msec.
    {
    int i,j ;
    for(i=0;i<msec;i++)
    for(j=0;j<1275;j++);
    }
     
    void lcdcmd(unsigned char item)  //Function to send command to LCD
    {
    dataport = item;
    rs= 0;
    rw=0;
    e=1;
    delay(1);
    e=0;
    }
     
    void lcddata(unsigned char item)  //Function to send data to LCD
    {
    dataport = item;
    rs= 1;
    rw=0;
    e=1;
    delay(1);
    e=0;
    }
     
    void lcdini()  //Function to initialize the LCD
    {
    lcdcmd(0x38);  
    delay(2);
    lcdcmd(0x0F); 
    delay(2);
    lcdcmd(0x82);  //Set cursor to blink at line 1 positon 2
    delay(2);
    }
     
    void countval(unsigned int x)  //hex to decimal counter (not sure it does)
    {          
    unsigned int j,l,k,m=1;
    int b[4];
     
    l= x&&0XF0; //masking higher bit (anding)
    k= x&&0x0F; // masking lower bit
    j= ((l*16)+(k*1)); //calculation higher bit * 16+lowerbit * 1 
     
    sprintf(b,”%d”, j); //frome some forum post to display values in LCD
     
    lcdcmd(0x38);  // for using 8-bit 2 row mode of LCD
    delay(100);
    lcdcmd(0x01);  //clear screen
    delay(100);
    lcdcmd(0x06);  //display ON
    delay(100);
    lcdcmd(0X80);
    lcddata(‘v’);
    lcdcmd(0X81);
    lcddata(‘=’);
    {lcdcmd(0x82); //putting decimal value to LCD
    lcddata(b[m]);
    }
    }
     
    void main()
    {
    rst=1;
    while (rst==1) //for continous looping i used this
    {
    unsigned int r=0,v=0;
     
    lcdini()  ;
    n=1;   //input pin p3.4
    TMOD=0X15; //is timer & another is counter
    TL0= 0;
    TH0=0;
    TR0=1;
    for (;r<28;r++) //28 times to 1 sec ( from some book that is in assembly language i converted to C )
    {
    TL1=0;
    TH1=0;
    TR1=1;
     
    while(TF1==0)
    TF1=0;
    TR1=0;
    }
    v=TL0; //moving count value to v.. CONFUSED with TL & TH value combination
    countval(v);
    delay(100);
    v=TH0;
    countval(v);
    return ;
    }
    }
     
    Really need help with this project…… PLZZZZZZZZZZ
     
    May 14, 2013 at 4:22 am #9739
    AJISH ALFRED
    Participant

    Hi Lakshmeesha,

    Very nice project. Tell us more details about the output you currently have in the LCD. If possible please post an image of the same so that we can identify what could be issue.

    May 15, 2013 at 7:57 am #9757
    lakshmeesha
    Participant

    heyyy.. thanks for replay…

     

    I’m not abel to convert 16 bit TH & TL hex values into decimal, and how to put them on LCD,, im getting nothing in LCD 

     

    wysiwyg_imageupload:8513:

    May 15, 2013 at 9:57 pm #9760
    lakshmeesha
    Participant

    one section is over (ADC)….. 1)fuel meter in ltrs, 2)kilometer aproximation for that much fuel, 3)Engin temp display, 4) daylight display

     

    remaining >  KMPH meter & trip meter

     

    wysiwyg_imageupload:8515:

    May 18, 2013 at 2:47 pm #9781
    lakshmeesha
    Participant

    finally its over……. EEPROM interfacing only remaining,,, im not able to do that one only :(

    wysiwyg_imageupload:8592:

    May 18, 2013 at 9:39 pm #9782
    waqi
    Participant

    Very nice project, can you show me the picture of your project.

    May 19, 2013 at 1:08 pm #9785
    lakshmeesha
    Participant

    now it is simulated, i need to purchase every hardware part, after hardware conversion i will show.

     

    May 19, 2013 at 5:30 pm #9788
    AJISH ALFRED
    Participant

    Hi Lakshmeesha,

    Nice project and so far you did a great job. Now it would be easy for you to make the hardware. If you face any issue with it please post here.

    Please don’t forget to share the details of the project with us so that we can also learn more.

    May 20, 2013 at 2:28 am #9796
    lakshmeesha
    Participant

    ha ha…

    kind of completed,

     

    instead of 89C51 i’m planning to use 89C51RD2, (i heard RE2 having inbuilt EPROM)

    saw 100000000 of errors BTW. 

    but still unable to interface EPROM, other than that all is working properly.

    if i interfaced EPROM it will shoe “ADDRESS OVERFLOW ERROR”

    for that we have to use XDATA, that is not working sad , i need EPROM to store last trip value.

    any ideas????

     

    finally

    wysiwyg_imageupload:8595: last line il LOL , 

     

     

     

     

     

     

     

     

     

     

     

     

    wysiwyg_imageupload:8596:

                                speed ||  trip||

    distence aproximation || fuel remaining|| engine temperature || light sense

    battery level|| fuel tap sense ( Mains,Reserve,Empty)|| mailge -( distence/(init fuel – fuel at that distence))

     

    May 20, 2013 at 5:10 am #9797
    lakshmeesha
    Participant

    Thanxxx…..

     

    its kind of over,

    but im failed to interface EPROM to it, showing overflow error,,

    May 22, 2013 at 5:14 pm #9812
    AJISH ALFRED
    Participant

    Hi,

    89c51 don’t have a built-in EEPROM, you can interface external serial EEPROMs using I2C.

    May 23, 2013 at 12:39 am #9814
    lakshmeesha
    Participant

    yes,, i did it,, finally its running with eprom (ic2), i ‘m saving trip value and top speed in it. now planning to interface GLCD to it, already hex files reached 22kb, and getting address overflow with some more variables

     

    May 24, 2013 at 2:53 am #9817
    lakshmeesha
    Participant
    hey….
     
    would you suggest me a good sensor for wheel sensing, i must counts more that 100hz (100 pulse),the wheel having 5 alloy sticks, it will disturb ir signal and have to get pulse from it,  is IR sensors with amplifier is ok??
    May 28, 2013 at 4:44 am #9846
    AJISH ALFRED
    Participant

    Hi,

    Magnetic Reed Sensor will do??

    May 29, 2013 at 12:48 pm #9862
    lakshmeesha
    Participant

    i need to attach magnet to wheel right??

    on that fast magnet will thrown away…..

  • Author
    Posts
Viewing 15 posts - 1 through 15 (of 31 total)
1 2 3 →
  • You must be logged in to reply to this topic.
Log In

RSS Recent Posts

  • Assistance locating a 'trail' camera gadget, please ? May 16, 2026
  • reviving old swordfish program but? May 16, 2026
  • Analog multiplexer has gone obselete May 16, 2026
  • Difference between TTL, RS232 and RS485 May 16, 2026
  • Smart Buoy project May 16, 2026

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2026 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise