ltsharma
Advanced Member level 4
- Joined
- May 26, 2013
- Messages
- 110
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,306
- Location
- banglore
- Activity points
- 2,003
hello, I am doing project on motorbike digital meter. I want to calculate acceleration, means 0 km/h to 60 km/h,
i did -
saved minutes and seconds value in eeprom on 0-1 transition of speedometer
like
and again speed reaches 60
like:
i have saved the minutes and seconds value to eeprom like:
then showing values like this :
Im not getting correct value, what is the problem here?
i did -
saved minutes and seconds value in eeprom on 0-1 transition of speedometer
like
Code:
Read_Time(&hours,&minutes,&seconds,&day,&week,&month,&year);
eeprom_write(0X020,seconds);
delay_ms(20);
eeprom_write(0X021,minutes);
delay_ms(20);
acnval=1;
like:
Code:
if(speed==60||speed==61||speed==62||speed==63)
{
if(acnval)
{
accln();
acnval=0;
}
}
Code:
accln()
{Read_Time(&hours,&minutes,&seconds,&day,&week,&month,&year);
eeprom_write(0X022,seconds);
delay_ms(20);
eeprom_write(0X023,minutes);
delay_ms(20);
}
then showing values like this :
Code:
minutes=eeprom_read(0x20);
minutes = ((minutes & 0xF0) >> 4)*10 + (minutes & 0x0F);
seconds=eeprom_read(0x21);
seconds = ((seconds & 0x70) >> 4)*10 + (seconds & 0x0F);
a_Seconds=(minutes*60)+seconds;
seconds=0;minutes=0;
minutes=eeprom_read(0x22);
minutes = ((minutes & 0xF0) >> 4)*10 + (minutes & 0x0F);
seconds=eeprom_read(0x23);
seconds = ((seconds & 0x70) >> 4)*10 + (seconds & 0x0F);
a_minutes=(minutes*60)+seconds;
seconds=0;minutes=0;
a_minutes=a_minutes-a_seconds;
a_Seconds=0;
inttostr(a_minutes,acln);
Glcd_write_text(acln),1,3,1);
a_minutes=0;
Im not getting correct value, what is the problem here?