This is default featured slide 1 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 2 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 3 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 4 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 5 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

Showing posts with label PCD8544. Show all posts
Showing posts with label PCD8544. Show all posts

Friday, October 23, 2015

Nokia 5110 LCD Library

The module Nokia 5110 is a monochrome graphic LCD with 48x84 pixels. This LCD has SPI interface and blue backlight. We can buy these modules for less 2 USD.


Module Features.
  • Resolution: 48 x 84 dot matrix panel.
  • Power supply: 3.3V.
  • Interface: SPI.
  • Driver IC: PCD8544.
Video.

Request.
Email contact: armicrocontroller@gmail.com


Description of library.

Initializes the Nokia5110 module.
Nokia5110_Init(void)

Example:
Nokia5110_Init();

Sets font that will be used.
Nokia5110_SetFont(_font, _width, _height, _min, _max)

  •  _font: desired font.
  • _width: sets the width in units of pixels.
  • _height: sets the height in units of pixels.
  • _min: sets the range minimum.
  • _max: sets the range maximum.
Example:
Nokia5110_SetFont(Terminal12x16, 12, 16, 32,127);



  • font name : Terminal12x16
  • width 12 pixels
  • height 16 pixels
  • range: start in character 32, end in  character 127
We can use "GLCD Font Creator" to design new fonts, symbols and icons.
Note: Only fonts with multiples of 8 pixels in height (8, 16, 24, 32 ... )

Writes a char on the Nokia5110.
Nokia5110_WriteChar(c, seg, pag)

  • c: char to be written.
  • seg: sets the segment. Valid values: 0..83
  • pag: sets the page. Valid values: 0..5
Example:
Nokia5110_WriteChar('A', 10, 3);

Prints text constant on Nokia5110.
Nokia5110_ConstText(buffer, seg, pag)

  • buffer: text to be written.
  •  seg: sets the segment. Valid values: 0..83
  • pag: sets the page. Valid values: 0..5
Example:
Nokia5110_ConstText("NOKIA", 0, 0);

Prints text variable on Nokia5110.
Nokia5110_Text(buffer, seg, pag)

  • buffer: text to be written.
  • seg: sets the segment. Valid values: 0..83
  • pag: sets the page. Valid values: 0..5
Example:
unsigned char i;
char buffer2[20];
i = 22;
sprintf(buffer2, "%03d", i);
Nokia5110_Text(buffer2, 0, 3);

Prints text constant on Nokia5110 with scroll.
Nokia5110_ConstTextScroll(buffer)

  • buffer: text to be written.
Example:
Nokia5110_SetFont(Terminal12x16, 12, 16, 32 , 127);
Nokia5110_ResetScroll();
while(1){
Nokia5110_ConstTextScroll("This is a new scroll function  ");
Delay_ms(50);
}

Prints text variable on Nokia5110 with scroll.
Nokia5110_TextScroll(buffer)

  • buffer: text to be written.
Example:
unsigned char i;
char buffer2[20];
i = 22;
sprintf(buffer2, "%03d   ", i);
Nokia5110_SetFont(Terminal12x16, 12, 16, 32 , 127);
Nokia5110_ResetScroll();
while(1){
Nokia5110_TextScroll(buffer2);
Delay_ms(50);
}

Resets the scroll.
Nokia5110_ResetScroll(void)

This function must be called before of a new scroll function.
Example:
Nokia5110_ResetScroll();

Fills Nokia5110 memory.
Nokia5110_FillScreen(pattern)

  • pattern: byte to fill Nokia5110 memory.
Example:
Nokia5110_FillScreen(0xFF);

Displays bitmap on Nokia5110.
Nokia5110_Image(buffer)

  • buffer: image to be displayed.
Example:
Nokia5110_Image(truck);

Displays an image on a desired location.
Nokia5110_Icon(buffer, seg, pag, _width, _height)

  • buffer: image to be displayed.
  • seg: sets the segment. Valid values: 0..83
  • pag: sets the page. Valid values: 0..5
  • _width sets the width of the image.
  • _height sets the height of the image.
Example:
Nokia5110_Icon(icon1,25,2,32,32);

Inverts the RAM memory.
Nokia5110_InvertRam(seg1, pag1, seg2, pag2)

  • seg1 sets the start segment. Valid values: 0..83
  • pag1 sets the start page. Valid values: 0..5
  • seg2 sets the end segment. Valid values: 0..83
  • pag2 sets the end page. Valid values: 0..5
Example:
Nokia5110_InvertRam(0, 0, 83, 5);

Draws a Pixel on Nokia5110.

Nokia5110_Pixel(x, y, color)

  • x: x position. Valid values: 0..83
  • y: y position. Valid values: 0..47
  • color: color parameter. Valid values: 1,2,3
Example:
Nokia5110_Pixel(40, 40, BLACK);

Draws a Line on Nokia5110.
Nokia5110_Line(x1, y1, x2, y2, color)
 

  • x1: x coordinate of the line start. Valid values: 0..83
  • y1: y coordinate of the line start. Valid values: 0..47
  • x2: x coordinate of the line end. Valid values: 0..83
  • y2: y coordinate of the line end. Valid values: 0..47
  • color: color parameter. Valid values: 1,2,3
Example:
Nokia5110_Line(0, 0, 83, 47, BLACK);

Draws a rectangle on Nokia5110.
Nokia5110_Rectangle(x1, y1, x2, y2, color)

  • x1: x coordinate of the upper left rectangle corner. Valid values: 0..83 
  • y1: y coordinate of the upper left rectangle corner. Valid values: 0..47
  • x2: x coordinate of the lower right rectangle corner. Valid values: 0..83
  • y2: y coordinate of the lower right rectangle corner. Valid values: 0..47
  • color: color parameter. Valid values: 1,2,3
Example:
Nokia5110_Rectangle(10, 10, 70, 40, BLACK);

Draws a circle on Nokia5110.
Nokia5110_Circle(x1, y1, radius, color)

  • x1: x coordinate of the circle center. Valid values: 0..83
  • y1: y coordinate of the circle center. Valid values: 0..47
  • radius: radius size
  • color: color parameter. Valid values: 1,2,3
Example:
Nokia5110_Circle(41, 23, 5, Black);


Connection.