Project 6  Monochrome Liquid-Crystal Display
Neff Site
Macros | Functions
nokia5110.h File Reference

Header file for the Nokia 5110 LCD. More...

#include "spi.h"
#include "pcd8544.h"

Go to the source code of this file.

Macros

#define NOKIA5110_PORT   PORTF
 
#define NOKIA5110_LED_bp   PIN1_bp
 
#define NOKIA5110_SCLK_bp   SPI_SCK_bp
 
#define NOKIA5110_DN_bp   SPI_MOSI_bp
 
#define NOKIA5110_DC_bp   PIN2_bp
 
#define NOKIA5110_RST_bp   PIN3_bp
 
#define NOKIA5110_SCE_bp   SPI_SS_bp
 
#define NOKIA5110_LED_bm   PIN1_bm
 
#define NOKIA5110_SCLK_bm   SPI_SCK_bm
 
#define NOKIA5110_DN_bm   SPI_MOSI_bm
 
#define NOKIA5110_DC_bm   PIN2_bm
 
#define NOKIA5110_RST_bm   PIN3_bm
 
#define NOKIA5110_SCE_bm   SPI_SS_bm
 
#define NOKIA5110_FONT_WIDTH   6
 
#define NOKIA5110_FONT_HEIGHT   8
 
#define NOKIA5110_LCD_WIDTH   84
 
#define NOKIA5110_LCD_HEIGHT   48
 
#define NOKIA5110_COLS   (NOKIA5110_LCD_WIDTH/NOKIA5110_FONT_WIDTH)
 
#define NOKIA5110_ROWS   (NOKIA5110_LCD_HEIGHT/NOKIA5110_FONT_HEIGHT)
 

Functions

void nokia5110_sendData (uint8_t byte)
 Send a data byte. More...
 
void nokia5110_sendCommand (uint8_t cmd)
 Send a command. More...
 
void nokia5110_resetController (void)
 Reset the display. More...
 
void nokia5110_init (void)
 Initialize the display. More...
 
void nokia5110_displayOn (void)
 Turn the display on. More...
 
void nokia5110_displayOff (void)
 Turn the display off. More...
 
void nokia5110_clearDisplay (void)
 Clear the display. More...
 
void nokia5110_setCursor (uint8_t x, uint8_t y)
 Set display position. More...
 
void nokia5110_putchar (char c)
 Display a character. More...
 
void nokia5110_puts (const char *s)
 Display a character string. More...
 
void nokia5110_putbmp (uint8_t x, uint8_t y, const uint8_t *bmp, uint8_t w, uint8_t h)
 Display a bitmap. More...
 

Detailed Description

Header file for the Nokia 5110 LCD.

This is a library for the Nokia 5110 monochrome liquid-crystal display.

Author
Wolfgang Neff
Version
2.0
Date
2016-05-14
History
Created: 2012-08-27
Modified: 2016-05-14
Modified: 2018-01-08

Macro Definition Documentation

◆ NOKIA5110_COLS

#define NOKIA5110_COLS   (NOKIA5110_LCD_WIDTH/NOKIA5110_FONT_WIDTH)

◆ NOKIA5110_DC_bm

#define NOKIA5110_DC_bm   PIN2_bm

◆ NOKIA5110_DC_bp

#define NOKIA5110_DC_bp   PIN2_bp

◆ NOKIA5110_DN_bm

#define NOKIA5110_DN_bm   SPI_MOSI_bm

◆ NOKIA5110_DN_bp

#define NOKIA5110_DN_bp   SPI_MOSI_bp

◆ NOKIA5110_FONT_HEIGHT

#define NOKIA5110_FONT_HEIGHT   8

◆ NOKIA5110_FONT_WIDTH

#define NOKIA5110_FONT_WIDTH   6

◆ NOKIA5110_LCD_HEIGHT

#define NOKIA5110_LCD_HEIGHT   48

◆ NOKIA5110_LCD_WIDTH

#define NOKIA5110_LCD_WIDTH   84

◆ NOKIA5110_LED_bm

#define NOKIA5110_LED_bm   PIN1_bm

◆ NOKIA5110_LED_bp

#define NOKIA5110_LED_bp   PIN1_bp

◆ NOKIA5110_PORT

#define NOKIA5110_PORT   PORTF

◆ NOKIA5110_ROWS

#define NOKIA5110_ROWS   (NOKIA5110_LCD_HEIGHT/NOKIA5110_FONT_HEIGHT)

◆ NOKIA5110_RST_bm

#define NOKIA5110_RST_bm   PIN3_bm

◆ NOKIA5110_RST_bp

#define NOKIA5110_RST_bp   PIN3_bp

◆ NOKIA5110_SCE_bm

#define NOKIA5110_SCE_bm   SPI_SS_bm

◆ NOKIA5110_SCE_bp

#define NOKIA5110_SCE_bp   SPI_SS_bp

◆ NOKIA5110_SCLK_bm

#define NOKIA5110_SCLK_bm   SPI_SCK_bm

◆ NOKIA5110_SCLK_bp

#define NOKIA5110_SCLK_bp   SPI_SCK_bp

Function Documentation

◆ nokia5110_clearDisplay()

void nokia5110_clearDisplay ( void  )

Clear the display.

Clears the display by filling it with the background color.

◆ nokia5110_displayOff()

void nokia5110_displayOff ( void  )

Turn the display off.

Turns the display and the background lighting off.

◆ nokia5110_displayOn()

void nokia5110_displayOn ( void  )

Turn the display on.

Turns the display and the background lighting on.

◆ nokia5110_init()

void nokia5110_init ( void  )

Initialize the display.

In the course of the initialization the following tasks are done:

  • Configure interface lines
  • Initialize SPI interface
  • Reset the display
  • Set horizontal addressing mode
  • Set display contrast

◆ nokia5110_putbmp()

void nokia5110_putbmp ( uint8_t  x,
uint8_t  y,
const uint8_t *  bmp,
uint8_t  w,
uint8_t  h 
)

Display a bitmap.

Displays a bitmap at the specified position.

Parameters
xThe x position.
yThe y position.
bmpThe bitmap to be displayed.
wThe width of the bitmap.
hThe height of the bitmap.

◆ nokia5110_putchar()

void nokia5110_putchar ( char  c)

Display a character.

Displays a character at the current cursor position. The controller has no build-in character map.

Parameters
cThe character to be displayed.

◆ nokia5110_puts()

void nokia5110_puts ( const char *  s)

Display a character string.

Displays a character string.

Parameters
sThe string to be displayed.

◆ nokia5110_resetController()

void nokia5110_resetController ( void  )

Reset the display.

Resets the display by pulling down the reset line.

◆ nokia5110_sendCommand()

void nokia5110_sendCommand ( uint8_t  cmd)

Send a command.

Sends a command to the display controller by selecting the slave and transmitting the data byte.

Parameters
cmdThe command to be sent.

◆ nokia5110_sendData()

void nokia5110_sendData ( uint8_t  byte)

Send a data byte.

Sends a data byte to the display controller by selecting the slave and transmitting the data byte.

Parameters
byteThe data byte to be sent.

◆ nokia5110_setCursor()

void nokia5110_setCursor ( uint8_t  x,
uint8_t  y 
)

Set display position.

Sets the position where the next data is written into the display RAM. For details please consult chapter 7.7 of the data sheet at page 9. The cursor is virtual and is not displayed.

Parameters
xThe horizontal position.
yThe vertical position.
Contact