Welcome, Guest. Please Login or Register
YaBB - Yet another Bulletin Board
09.02.2010 at 18:09:35
News: Server upgrade went fine, you are now at the new system


Pages: 1
BIG numbers from a little LCD (Read 3925 times)
dcb
Senior Member
****
Offline



Posts: 421

BIG numbers from a little LCD
13.06.2008 at 02:13:59
 
Heres a little idea that someone might find useful Smiley  You all know the ubitiquous little 16x2 LCDs.  Well they can be taught to display numbers 6X as large if you define a couple block custom characters.



here is a little more detail


My hacked up code doesn't fit here and wasn't pretty anywhoo, but you get the idea Smiley
Back to top
 
 
View Profile   IP Logged
big93
Senior Member
****
Offline

Arduino rocks

Posts: 495

Re: BIG numbers from a little LCD
Reply #1 - 13.06.2008 at 20:29:55
 
looks usefull for projects requring number sights from a distance... i think that the mpg idea is really good for it.

post code somewhere, i'll be intrested to see!
Back to top
 
 
View Profile   IP Logged
dcb
Senior Member
****
Offline



Posts: 421

Re: BIG numbers from a little LCD
Reply #2 - 14.06.2008 at 08:45:05
 
I won't go through all the LCD stuff (mine is a little customized), but here are the important bits (don't have a fancy formatter yet):
Code:
//create some strings to index into for displaying the big numbers
//			    0	   1	  2	  3	  4	    5	   6	 7	   8	   9
char bignumchars1[]={4,1,4,0, 1,4,32,0, 3,3,4,0, 1,3,4,0, 4,2,4,0,   4,3,3,0, 4,3,3,0, 1,1,4,0,   4,3,4,0, 4,3,4,0};
char bignumchars2[]={4,2,4,0, 2,4,2,0,  4,2,2,0, 2,2,4,0, 32,32,4,0, 2,2,4,0, 4,2,4,0, 32,32,4,0, 4,2,4,0, 2,2,4,0};

...
//cycle through printing out 0 to 9
void loop (void){    
  for(int x = 0;x<10;x++){
    lcd.gotoXY(0,0);
    lcd.print(bignumchars1+x*4);
    lcd.gotoXY(0,1);
    lcd.print(bignumchars2+x*4);
    delay(1000);
  }
}    
...

void setup (void){
...
//creating the custom fonts:
  LcdCommandWrite(B01001000);  // set cgram
  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    
...
}
 



Course the technique isn't limited to numbers, or a 3x2 character box, or 16x2 LCDs.
Back to top
 
« Last Edit: 14.06.2008 at 14:58:44 by dcb »  
View Profile   IP Logged
GekoCH
Full Member
***
Offline



Posts: 158
Switzerland
Re: BIG numbers from a little LCD
Reply #3 - 15.08.2008 at 17:25:48
 
hmm I tried to put your code into my sketch put I do get just
very curious characters on the LCD.

Could you pls send me the hole sketch?

Andy
Back to top
 
 
View Profile | WWW   IP Logged
ESX
YaBB Newbies
*
Offline

Uia!

Posts: 2
SAO PAULO/BRAZIL
Gender: female
Re: BIG numbers from a little LCD
Reply #4 - 28.11.2008 at 11:59:32
 
this is dont work LCD3wires library
 Sad

why ?
Back to top
 
 
View Profile | MSN   IP Logged
ESX
YaBB Newbies
*
Offline

Uia!

Posts: 2
SAO PAULO/BRAZIL
Gender: female
Re: BIG numbers from a little LCD
Reply #5 - 29.11.2008 at 13:20:46
 
works fine !!!  Cheesy Cheesy Cheesy


Code:
// Example use of LCD3Wire library
// Almost a carbon-copy of LCD4BitExample.pde
#include <avr/pgmspace.h>  
#include <LCD3Wire.h>

//LCD Pins
#define LCD_LINES 2  // number of lines in your display

#define CLK_PIN   9  // Clock pin pwm
#define DOUT_PIN  11  // Dout pin pwm
#define STR_PIN   12  // Strobe pin

//create object to control an LCD.  
LCD3Wire lcd = LCD3Wire(LCD_LINES, DOUT_PIN, STR_PIN, CLK_PIN);


void setup() {

  lcd.init();

//creating the custom fonts:
  lcd.commandWrite(B01001000);  // set cgram
  static byte chars[] PROGMEM ={
    B11111,B00000,B11111,B11111,B00000,
    B11111,B00000,B11111,B11111,B00000,
    B11111,B00000,B11111,B11111,B00000,
    B00000,B00000,B00000,B11111,B00000,
    B00000,B00000,B00000,B11111,B00000,
    B00000,B11111,B11111,B11111,B01110,
    B00000,B11111,B11111,B11111,B01110,
    B00000,B11111,B11111,B11111,B01110};



    for(byte x=0;x<5;x++)
	{
	  byte a=(x+1<<3)|0x40;

      for(byte y=0;y<8;y++)
	  {
          lcd.commandWrite(a++); //write the character data to the character generator ram
		  lcd.print(pgm_read_byte(&chars[y*5+x]));
	  }
	}



  lcd.commandWrite(B00000001);  // clear display, set cursor position to zero
  lcd.commandWrite(B10000000);  // set dram to zero
  

}
char bignumchars1[]={4,1,4,0, 1,4,32,0, 3,3,4,0, 1,3,4,0, 4,2,4,0,   4,3,3,0, 4,3,3,0, 1,1,4,0,   4,3,4,0, 4,3,4,0};
char bignumchars2[]={4,2,4,0, 2,4,2,0,  4,2,2,0, 2,2,4,0, 32,32,4,0, 2,2,4,0, 4,2,4,0, 32,32,4,0, 4,2,4,0, 2,2,4,0};


void loop() {  

	for(int x = 0;x<10;x++){

	lcd.clear();
    lcd.cursorTo(0);
    lcd.printIn(bignumchars1+x*4);

    lcd.cursorTo(1);
    lcd.printIn(bignumchars2+x*4);

    delay(1000);
  }
}

 

Back to top
 
 
View Profile | MSN   IP Logged
Pages: 1