Draw bitmap on 5110 nokia lcd without library


draw bitmap on 5110 nokia lcd without library?

does have code share or link?

i use code display simple text. need bitmap.
any hint .

/*
scrolling text example code
modified from: http://www.arduino.cc/playground/code/pcd8544
*/
#include <avr/pgmspace.h>

// pins use on arduino
#define pin_sce   8
#define pin_reset 3
#define pin_dc    5
#define pin_sdin  6
#define pin_sclk  7

// configuration lcd
#define lcd_c     low
#define lcd_d     high
#define lcd_cmd   0

// size of lcd
#define lcd_x     84
#define lcd_y     48

int scrollposition = -10;

static const byte progmem ascii[][5] =
{
{0x00, 0x00, 0x00, 0x00, 0x00},
{0x00, 0x00, 0x5f, 0x00, 0x00},
{0x00, 0x07, 0x00, 0x07, 0x00},
{0x14, 0x7f, 0x14, 0x7f, 0x14},
{0x24, 0x2a, 0x7f, 0x2a, 0x12},
{0x23, 0x13, 0x08, 0x64, 0x62},
{0x36, 0x49, 0x55, 0x22, 0x50},
{0x00, 0x05, 0x03, 0x00, 0x00},
{0x00, 0x1c, 0x22, 0x41, 0x00},
{0x00, 0x41, 0x22, 0x1c, 0x00},
{0x14, 0x08, 0x3e, 0x08, 0x14},
{0x08, 0x08, 0x3e, 0x08, 0x08},
{0x00, 0x50, 0x30, 0x00, 0x00},
{0x08, 0x08, 0x08, 0x08, 0x08},
{0x00, 0x60, 0x60, 0x00, 0x00},
{0x20, 0x10, 0x08, 0x04, 0x02},
{0x3e, 0x51, 0x49, 0x45, 0x3e},
{0x00, 0x42, 0x7f, 0x40, 0x00},
{0x42, 0x61, 0x51, 0x49, 0x46},
{0x21, 0x41, 0x45, 0x4b, 0x31},
{0x18, 0x14, 0x12, 0x7f, 0x10},
{0x27, 0x45, 0x45, 0x45, 0x39},
{0x3c, 0x4a, 0x49, 0x49, 0x30},
{0x01, 0x71, 0x09, 0x05, 0x03},
{0x36, 0x49, 0x49, 0x49, 0x36},
{0x06, 0x49, 0x49, 0x29, 0x1e},
{0x00, 0x36, 0x36, 0x00, 0x00},
{0x00, 0x56, 0x36, 0x00, 0x00},
{0x08, 0x14, 0x22, 0x41, 0x00},
{0x14, 0x14, 0x14, 0x14, 0x14},
{0x00, 0x41, 0x22, 0x14, 0x08},
{0x02, 0x01, 0x51, 0x09, 0x06},
{0x32, 0x49, 0x79, 0x41, 0x3e},
{0x7e, 0x11, 0x11, 0x11, 0x7e},
{0x7f, 0x49, 0x49, 0x49, 0x36},
{0x3e, 0x41, 0x41, 0x41, 0x22},
{0x7f, 0x41, 0x41, 0x22, 0x1c},
{0x7f, 0x49, 0x49, 0x49, 0x41},
{0x7f, 0x09, 0x09, 0x09, 0x01},
{0x3e, 0x41, 0x49, 0x49, 0x7a},
{0x7f, 0x08, 0x08, 0x08, 0x7f},
{0x00, 0x41, 0x7f, 0x41, 0x00},
{0x20, 0x40, 0x41, 0x3f, 0x01},
{0x7f, 0x08, 0x14, 0x22, 0x41},
{0x7f, 0x40, 0x40, 0x40, 0x40},
{0x7f, 0x02, 0x0c, 0x02, 0x7f},
{0x7f, 0x04, 0x08, 0x10, 0x7f},
{0x3e, 0x41, 0x41, 0x41, 0x3e},
{0x7f, 0x09, 0x09, 0x09, 0x06},
{0x3e, 0x41, 0x51, 0x21, 0x5e},
{0x7f, 0x09, 0x19, 0x29, 0x46},
{0x46, 0x49, 0x49, 0x49, 0x31},
{0x01, 0x01, 0x7f, 0x01, 0x01},
{0x3f, 0x40, 0x40, 0x40, 0x3f},
{0x1f, 0x20, 0x40, 0x20, 0x1f},
{0x3f, 0x40, 0x38, 0x40, 0x3f},
{0x63, 0x14, 0x08, 0x14, 0x63},
{0x07, 0x08, 0x70, 0x08, 0x07},
{0x61, 0x51, 0x49, 0x45, 0x43},
{0x00, 0x7f, 0x41, 0x41, 0x00},
{0x02, 0x04, 0x08, 0x10, 0x20},
{0x00, 0x41, 0x41, 0x7f, 0x00},
{0x04, 0x02, 0x01, 0x02, 0x04},
{0x40, 0x40, 0x40, 0x40, 0x40},
{0x00, 0x01, 0x02, 0x04, 0x00},
{0x20, 0x54, 0x54, 0x54, 0x78},
{0x7f, 0x48, 0x44, 0x44, 0x38},
{0x38, 0x44, 0x44, 0x44, 0x20},
{0x38, 0x44, 0x44, 0x48, 0x7f},
{0x38, 0x54, 0x54, 0x54, 0x18},
{0x08, 0x7e, 0x09, 0x01, 0x02},
{0x0c, 0x52, 0x52, 0x52, 0x3e},
{0x7f, 0x08, 0x04, 0x04, 0x78},
{0x00, 0x44, 0x7d, 0x40, 0x00},
{0x20, 0x40, 0x44, 0x3d, 0x00},
{0x7f, 0x10, 0x28, 0x44, 0x00},
{0x00, 0x41, 0x7f, 0x40, 0x00},
{0x7c, 0x04, 0x18, 0x04, 0x78},
{0x7c, 0x08, 0x04, 0x04, 0x78},
{0x38, 0x44, 0x44, 0x44, 0x38},
{0x7c, 0x14, 0x14, 0x14, 0x08},
{0x08, 0x14, 0x14, 0x18, 0x7c},
{0x7c, 0x08, 0x04, 0x04, 0x08},
{0x48, 0x54, 0x54, 0x54, 0x20},
{0x04, 0x3f, 0x44, 0x40, 0x20},
{0x3c, 0x40, 0x40, 0x20, 0x7c},
{0x1c, 0x20, 0x40, 0x20, 0x1c},
{0x3c, 0x40, 0x30, 0x40, 0x3c},
{0x44, 0x28, 0x10, 0x28, 0x44},
{0x0c, 0x50, 0x50, 0x50, 0x3c},
{0x44, 0x64, 0x54, 0x4c, 0x44},
{0x00, 0x08, 0x36, 0x41, 0x00},
{0x00, 0x00, 0x7f, 0x00, 0x00},
{0x00, 0x41, 0x36, 0x08, 0x00},
{0x10, 0x08, 0x08, 0x10, 0x08},
{0x00, 0x06, 0x09, 0x09, 0x06},
};

void lcdcharacter(char character)
{
  lcdwrite(lcd_d, 0x00);
  (int index = 0; index < 5; index++)
  {
    lcdwrite(lcd_d, pgm_read_byte(&ascii[character - 0x20][index]));
  }
// lcdwrite(lcd_d, 0x00);
}

void lcdclear(void)
{
  (int index = 0; index < lcd_x * lcd_y / 8; index++)
  {
    lcdwrite(lcd_d, 0x00);
  }
}

void lcdinitialise(void)
{
  pinmode(pin_sce,   output);
  pinmode(pin_reset, output);
  pinmode(pin_dc,    output);
  pinmode(pin_sdin,  output);
  pinmode(pin_sclk,  output);

  digitalwrite(pin_reset, low);
  digitalwrite(pin_reset, high);

  lcdwrite(lcd_cmd, 0x21);  // lcd extended commands.
  lcdwrite(lcd_cmd, 0xb1);  // set lcd vop (contrast). //b1
  lcdwrite(lcd_cmd, 0x04);  // set temp coefficent. //0x04
  lcdwrite(lcd_cmd, 0x14);  // lcd bias mode 1:48. //0x13
  lcdwrite(lcd_cmd, 0x0c);  // lcd in normal mode. 0x0d inverse
  lcdwrite(lcd_c, 0x20);
  lcdwrite(lcd_c, 0x0c);
}

void lcdstring(char *characters)
{
  while (*characters)
  {
    lcdcharacter(*characters++);
  }
}

void lcdwrite(byte dc, byte data)
{
  digitalwrite(pin_dc, dc);
  digitalwrite(pin_sce, low);
  shiftout(pin_sdin, pin_sclk, msbfirst, data);
  digitalwrite(pin_sce, high);
}

/**
* gotoxy routine position cursor
* x - range: 0 84
* y - range: 0 5
*/
void gotoxy(int x, int y)
{
  lcdwrite( 0, 0x80 | x);  // column.
  lcdwrite( 0, 0x40 | y);  // row.
}

void drawbox(void)
{
  int j;
  for(j = 0; j < 84; j++) // top
  {
    gotoxy(j, 0);
    lcdwrite(1, 0x01);
  }

  for(j = 0; j < 84; j++) //bottom
  {
    gotoxy(j, 5);
    lcdwrite(1, 0x80);
  }

  for(j = 0; j < 6; j++) // right
  {
    gotoxy(83, j);
    lcdwrite(1, 0xff);
  }

  for(j = 0; j < 6; j++) // left
  {
    gotoxy(0, j);
    lcdwrite(1, 0xff);
  }
}

void scroll(string message)
{
  (int = scrollposition; < scrollposition + 11; i++)
  {
    if ((i >= message.length()) || (i < 0))
    {
      lcdcharacter(' ');
    }
    else
    {
      lcdcharacter(message.charat(i));
    }
  }
  scrollposition++;
  if ((scrollposition >= message.length()) && (scrollposition > 0))
  {
    scrollposition = -10;
  }
}

void setup(void)
{
  lcdinitialise();
  lcdclear();
  drawbox();

  gotoxy(7,1);
  lcdstring("nokia 5110");
  gotoxy(4,2);
  lcdstring("scroll demo");
}

void loop(void)
{
  gotoxy(4,4);
  scroll("scrolling message mindkits.co.nz / blog.stuartlewis.com");
  delay(200);
}

quote
draw bitmap on 5110 nokia lcd without library?

why?

quote
does have code share or link?

no.

quote
any hint .

a bitmap series of pixels specific colors. since code have can deal specific pixel, part easy. getting pixel right color looks bit more challenging.


Arduino Forum > Using Arduino > Programming Questions > Draw bitmap on 5110 nokia lcd without library


arduino

Comments

Popular posts from this blog

Connecting Raspberry Pi 2 to P10(1R)-V706 LED Dot Matrix - Raspberry Pi Forums

TypeError: <unknown> is not a numpy array - Raspberry Pi Forums

datso and removing imagetitle - Joomla! Forum - community, help and support