BIG numbers from a little LCD

Heres a little idea that someone might find useful :slight_smile: 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 :slight_smile:

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!

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):

//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.

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

this is dont work LCD3wires library
:frowning:

why ?

works fine !!! :smiley: :smiley: :smiley:

// 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);
  }
}