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 10 years ago by
lakshmeesha.
-
AuthorPosts
-
May 13, 2013 at 8:02 pm #2402
lakshmeesha
Participanthello,
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 100sbit rs = cmdport^0; //register select pinsbit rw = cmdport^1; // read write pinsbit e = cmdport^2; //enable pinsbit 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 2delay(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 bitj= ((l*16)+(k*1)); //calculation higher bit * 16+lowerbit * 1sprintf(b,”%d”, j); //frome some forum post to display values in LCDlcdcmd(0x38); // for using 8-bit 2 row mode of LCDdelay(100);lcdcmd(0x01); //clear screendelay(100);lcdcmd(0x06); //display ONdelay(100);lcdcmd(0X80);lcddata(‘v’);lcdcmd(0X81);lcddata(‘=’);{lcdcmd(0x82); //putting decimal value to LCDlcddata(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.4TMOD=0X15; //is timer & another is counterTL0= 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 combinationcountval(v);delay(100);v=TH0;countval(v);return ;}}Really need help with this project…… PLZZZZZZZZZZMay 14, 2013 at 4:22 am #9739AJISH ALFRED
ParticipantHi 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 #9757lakshmeesha
Participantheyyy.. 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
May 15, 2013 at 9:57 pm #9760lakshmeesha
Participantone 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
May 18, 2013 at 2:47 pm #9781lakshmeesha
Participantfinally its over……. EEPROM interfacing only remaining,,, im not able to do that one only
May 18, 2013 at 9:39 pm #9782waqi
ParticipantVery nice project, can you show me the picture of your project.
May 19, 2013 at 1:08 pm #9785lakshmeesha
Participantnow it is simulated, i need to purchase every hardware part, after hardware conversion i will show.
May 19, 2013 at 5:30 pm #9788AJISH ALFRED
ParticipantHi 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 #9796lakshmeesha
Participantha 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
, i need EPROM to store last trip value.
any ideas????
finally
wysiwyg_imageupload:8595: last line il LOL ,
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 #9797lakshmeesha
ParticipantThanxxx…..
its kind of over,
but im failed to interface EPROM to it, showing overflow error,,
May 22, 2013 at 5:14 pm #9812AJISH ALFRED
ParticipantHi,
89c51 don’t have a built-in EEPROM, you can interface external serial EEPROMs using I2C.
May 23, 2013 at 12:39 am #9814lakshmeesha
Participantyes,, 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 #9817lakshmeesha
Participanthey….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 #9846AJISH ALFRED
ParticipantHi,
Magnetic Reed Sensor will do??
May 29, 2013 at 12:48 pm #9862lakshmeesha
Participanti need to attach magnet to wheel right??
on that fast magnet will thrown away…..
-
AuthorPosts
- You must be logged in to reply to this topic.