06-12-2008, 02:56 PM
|
#21 (permalink)
|
EcoModding Lurker
Join Date: Jun 2008
Location: NC
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
|
for just an inst. mpg reading the 16x2 LCD is over kill. that was the thought at least.
|
|
|
Today
|
|
|
Other popular topics in this forum...
|
|
|
06-12-2008, 04:03 PM
|
#22 (permalink)
|
EcoModding Lurker
Join Date: Jun 2008
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
Quote:
Originally Posted by MilesPerTank
for just an inst. mpg reading the 16x2 LCD is over kill. that was the thought at least.
|
It certainly was *my* thought - I was also wondering if a single readout like that needs the full processor power, or if some simpler device can do {2 inputs+some basic math=an instantaneous mpg number}. Just have to adjust for 2 variables and one calculation, as far as my Luddite mind can tell.
|
|
|
06-12-2008, 07:02 PM
|
#23 (permalink)
|
needs more cowbell
Join Date: Feb 2008
Location: ÿ
Posts: 5,038
Thanks: 158
Thanked 269 Times in 212 Posts
|
I really like the big numbers idea, it just hasn't bubbled to the top of the stack yet. Here is a quick example of what I had in mind (no hardware change necessary):
Also note that we are/will be using the trip functions for calibrating the gauge.
__________________
WINDMILLS DO NOT WORK THAT WAY!!!
Last edited by dcb; 06-12-2008 at 09:24 PM..
|
|
|
06-12-2008, 07:09 PM
|
#24 (permalink)
|
EcoModding Lurker
Join Date: Jun 2008
Location: NC
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
|
That looks great. Send me that software version !
|
|
|
06-12-2008, 07:38 PM
|
#25 (permalink)
|
needs more cowbell
Join Date: Feb 2008
Location: ÿ
Posts: 5,038
Thanks: 158
Thanked 269 Times in 212 Posts
|
I'm glad you like it It is just a mockup, it doesn't do anything and has not been integrated to the mpguino codebase, but here is the code if you are interested. I basically build the numbers with 5 custom block shaped characters (will need to get rid of the current custom characters for this)
PHP Code:
//GPL Software
byte brightness[]={0,42,85,128}; //middle button cycles through these brightness settings
#define brightnessLength (sizeof(brightness)/sizeof(byte)) //array size
byte brightnessIdx=2;
#define contrast 15
//LCD Pins
#define DIPin 4 // register select RS
#define DB4Pin 7
#define DB5Pin 8
#define DB6Pin 12
#define DB7Pin 13
#define ContrastPin 6
#define EnablePin 5
#define BrightnessPin 9
#define lcdpowerPin 15
//LCD prototype
class LCD{
public:
LCD( ) ;
void gotoXY(byte x, byte y);
void print(char * string);
void init();
void tickleEnable();
void cmdWriteSet();
void LcdCommandWrite(byte value);
void LcdDataWrite(byte value);
byte pushNibble(byte value);
};
//main objects we will be working with:
LCD lcd;
void setup (void){
pinMode(lcdpowerPin,OUTPUT);
digitalWrite(lcdpowerPin,LOW);
pinMode(BrightnessPin,OUTPUT);
analogWrite(BrightnessPin,255-brightness[brightnessIdx]);
delay(500);
digitalWrite(lcdpowerPin,HIGH);
lcd.init();
pinMode(ContrastPin,OUTPUT);
analogWrite(ContrastPin,contrast);
lcd.LcdDataWrite(3); lcd.LcdDataWrite(2); lcd.LcdDataWrite(3); lcd.LcdDataWrite(32);
lcd.LcdDataWrite(3); lcd.LcdDataWrite(2); lcd.LcdDataWrite(3); lcd.LcdDataWrite(32);
lcd.LcdDataWrite(0); lcd.LcdDataWrite(0); lcd.LcdDataWrite(3); lcd.LcdDataWrite(32);
lcd.print("INST");
lcd.gotoXY(0,1);
lcd.LcdDataWrite(1); lcd.LcdDataWrite(1); lcd.LcdDataWrite(3); lcd.LcdDataWrite(32);
lcd.LcdDataWrite(3); lcd.LcdDataWrite(1); lcd.LcdDataWrite(3); lcd.LcdDataWrite(4);
lcd.LcdDataWrite(32); lcd.LcdDataWrite(32); lcd.LcdDataWrite(3); lcd.LcdDataWrite(32);
lcd.print("MPG");
}
void loop (void){
while(true){}
}
//LCD functions
LCD::LCD(){
}
//x=0..16, y= 0..1
void LCD::gotoXY(byte x, byte y){
byte dr=x+0x80;
if (y==1)
dr += 0x40;
if (y==2)
dr += 0x14;
if (y==3)
dr += 0x54;
lcd.LcdCommandWrite(dr);
}
void LCD::print(char * string){
byte x = 0;
char c = string[x];
while(c != 0){
lcd.LcdDataWrite(c);
x++;
c = string[x];
}
}
//do the lcd initialization voodoo
void LCD::init(){
pinMode(EnablePin,OUTPUT);
pinMode(DIPin,OUTPUT);
pinMode(DB4Pin,OUTPUT);
pinMode(DB5Pin,OUTPUT);
pinMode(DB6Pin,OUTPUT);
pinMode(DB7Pin,OUTPUT);
delay(500);
LcdCommandWrite(B00000010); // 4 bit operation
LcdCommandWrite(B00101000);// 4-bit interface, 2 display lines, 5x8 font
LcdCommandWrite(B00001100); // display control:
LcdCommandWrite(B00000110); // entry mode set: increment automatically, no display shift
LcdCommandWrite(B01000000); // set cgram
//create some custom characters
byte chars[]={
B11111,B00000,B11111,B11111,B00000,
B11111,B00000,B11111,B11111,B00000,
B00000,B00000,B00000,B11111,B00000,
B00000,B00000,B00000,B11111,B00000,
B00000,B00000,B00000,B11111,B00000,
B00000,B00000,B00000,B11111,B01110,
B00000,B11111,B11111,B11111,B01110,
B00000,B11111,B11111,B11111,B01110};
for(byte x=0;x<5;x++)
for(byte y=0;y<8;y++)
LcdDataWrite(chars[y*5+x]); //write the character data to the character generator ram
LcdCommandWrite(B00000001); // clear display, set cursor position to zero
LcdCommandWrite(B10000000); // set dram to zero
}
void LCD::tickleEnable(){
// send a pulse to enable
digitalWrite(EnablePin,HIGH);
delayMicroseconds(1); // pause 1 ms according to datasheet
digitalWrite(EnablePin,LOW);
delayMicroseconds(1); // pause 1 ms according to datasheet
}
void LCD::cmdWriteSet(){
digitalWrite(EnablePin,LOW);
delayMicroseconds(1); // pause 1 ms according to datasheet
digitalWrite(DIPin,0);
}
byte LCD::pushNibble(byte value){
digitalWrite(DB7Pin, value & 128);
value <<= 1;
digitalWrite(DB6Pin, value & 128);
value <<= 1;
digitalWrite(DB5Pin, value & 128);
value <<= 1;
digitalWrite(DB4Pin, value & 128);
value <<= 1;
return value;
}
void LCD::LcdCommandWrite(byte value){
value=pushNibble(value);
cmdWriteSet();
tickleEnable();
value=pushNibble(value);
cmdWriteSet();
tickleEnable();
delay(5);
}
void LCD::LcdDataWrite(byte value){
digitalWrite(DIPin, HIGH);
value=pushNibble(value);
tickleEnable();
value=pushNibble(value);
tickleEnable();
delay(5);
}
__________________
WINDMILLS DO NOT WORK THAT WAY!!!
|
|
|
06-12-2008, 11:07 PM
|
#26 (permalink)
|
EcoModding Lurker
Join Date: Jun 2008
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
Quote:
Originally Posted by dcb
I'm glad you like it It is just a mockup, it doesn't do anything and has not been integrated to the mpguino codebase, but here is the code if you are interested. I basically build the numbers with 5 custom block shaped characters (will need to get rid of the current custom characters for this)
|
Now all you need is a gumstick-size board to slip behind the display and it'll fit just about anywhere! With all the creative programming, your next feat will be a scrolling display!
|
|
|
06-13-2008, 10:03 AM
|
#27 (permalink)
|
needs more cowbell
Join Date: Feb 2008
Location: ÿ
Posts: 5,038
Thanks: 158
Thanked 269 Times in 212 Posts
|
With all those pins sticking out of the nano, and given the size of the LCD, it would actually be a little larger than the custom efforts, i.e. http://ecomodder.com/forum/showthrea...3692#post33692
And I felt enough like Myron Reducto when I was making that
"I'll make you fun sized!"
__________________
WINDMILLS DO NOT WORK THAT WAY!!!
Last edited by dcb; 06-13-2008 at 11:10 AM..
|
|
|
06-13-2008, 10:16 AM
|
#28 (permalink)
|
EcoModding Apprentice
Join Date: Feb 2008
Location: Streamwood, IL
Posts: 105
Dakota - '00 Dodge Dakota Club Cab, Sport 90 day: 18.57 mpg (US) Jeep - '01 Jeep Wrangler TJ Sport 90 day: 18.46 mpg (US)
Thanks: 0
Thanked 1 Time in 1 Post
|
That looks great. That would make it easier to read without having to be too distracted. Plus, a big, glaring number would maybe encourage your to drive "better"!
Have it show a steady reading, or cycle through several settings every second or so, or wish, wish, wish, wish...
Keep in mind the 100+MPG people... maybe they won't need the tenths?
Accuracy and reliability before eye candy, though.
__________________
|
|
|
06-13-2008, 10:52 AM
|
#29 (permalink)
|
needs more cowbell
Join Date: Feb 2008
Location: ÿ
Posts: 5,038
Thanks: 158
Thanked 269 Times in 212 Posts
|
Quote:
Originally Posted by awillard69
Keep in mind the 100+MPG people... maybe they won't need the tenths?
|
Agreed, the formatter should drop the decimal point if the number is over 99.9
Quote:
Originally Posted by awillard69
Accuracy and reliability before eye candy, though.
|
Exactly
__________________
WINDMILLS DO NOT WORK THAT WAY!!!
|
|
|
06-18-2008, 06:37 PM
|
#30 (permalink)
|
EcoModding Apprentice
Join Date: Mar 2008
Location: indiana
Posts: 233
Thanks: 0
Thanked 0 Times in 0 Posts
|
Just trying to keep main thread clean.
Does this still work with EOC coasting or neutral coasting? How does it work in that situation. If i shut my car off , and turn key back to on. mpguino would lose power in my car.
|
|
|
|