View Single Post
Old 03-06-2012, 08:55 PM   #42 (permalink)
oldskool
EcoModding Lurker
 
Join Date: Nov 2011
Location: malaysia
Posts: 7
Thanks: 1
Thanked 0 Times in 0 Posts
Thanks again TOC,

I will give the result as soon as possible TOC. By the way, i still do not know why in MMCd source code using the function below to get the value. Have a look at the source code:

Code:
// Engine speed, 0..8000 rpm
// 31.25 * x
Int16 f_ERPM(UInt8 d, Char *s) {
	Int32 v = 2048000L * d;
	return StrPrintF(s, "%ldrpm", v >> 16);
}
Where does the value 2048000L is coming. If I'm not wrong the 'L" is use for formatting the data value

Arduino IntegerConstants
arduino.cc/en/Reference/IntegerConstants

Quote:
U & L formatters

By default, an integer constant is treated as an int with the attendant limitations in values. To specify an integer constant with another data type, follow it with:

a 'u' or 'U' to force the constant into an unsigned data format. Example: 33u
a 'l' or 'L' to force the constant into a long data format. Example: 100000L
a 'ul' or 'UL' to force the constant into an unsigned long constant. Example: 32767u
  Reply With Quote