The Nokia 5110 is a basic monochrome graphic LCD screen originally manufactured for use in cell phones
(1). This component is now largely superceded for such applications, but due to previous high manufacturing volumes is widely available (cheaply via ebay/China) for hobbyists etc. These LCD screens are available for approximately $3 (or less if buying a number together) which is similar/less than the typical HD44780 based 16x2 line LCD module. The typical HD44780 based LCD is much larger and consumes more power. The Nokia 5110, using a "6x8" font (which is quite readable) enables effectively 14 characters by 6 lines of output, and additionally, allows the ability to display graphics such as bitmaps, produce graphs etc. The Nokia 5110 consumes very little power making battery powered applications amenable. The downside is the additional ROM/RAM required by the PIC microcontroller (or similar) to interface the Nokia 5110.
It uses the PCD8544 controller, which is the same used in the Nokia 3310 LCD. The PCD8544 is a low power CMOS LCD controller/driver, designed to drive a graphic display of 48 rows and 84 columns. All necessary functions for the display are provided in a single chip, including on-chip generation of LCD supply and bias voltages, resulting in a minimum of external components and low power consumption. The PCD8544 interfaces to microcontrollers through a serial bus (SPI) interface. The component is typically available through ebay from various resellers already mounted on a PCB with 6-pin connector only requiring connection to the target circuit/application. Some features of the component from the datasheet:
Single chip LCD controller/driver
48 row, 84 column outputs
Display data RAM 48 × 84 bits
Serial interface maximum 4.0 Mbits/s
Logic supply voltage range VDD to VSS 2.7V to 3.3V
Limiting values: supply voltage VDD: 7V
Limiting values: all input voltages: VDD + 0.5V
The units purchased/tested were shipped already mounted on a PCB, so only the connections to supply electricity and control lines were necessary to attach. This is discussed in the "Circuit Details" section. The major item to note is the requirement for a 3.3 volt supply. There are many sites that advise that the Nokia 5110 can be successfully interfaced using 5v (convenient for the typical microcontroller), however, there are similar number of sites that advise against this (including the datasheet). Since a 3.3v supply is not particularly problematic (e.g. using readily available/cheap LM1086 linear regulator or similar, or even diodes and/or resistor divider network etc if funds really tight!) the Nokia 5110 is used with 3.3v during this testing.
This 3.3v supply for the Nokia 5110 also extends to the control line voltages. Since the PIC 16F876A used here (and many similar PIC microcontrollers) produces nominally 5v on the output pins, a voltage level converter is required. This could again be a resistor divider network (if funds particularly problematic), but since components such as CD4050 hex non-inverting buffer IC's are readily available (at time of writing, can purchase 10x CD4050 for ~$3 from ebay/Hong Kong) this has been used between the PIC 16F876A and the Nokia 5110. See the "Circuit Details" and "Schematic Diagram" Sections for full details.
There are a number of software libraries available for interfacing the Nokia 5110 to various microcontrollers. The software used is based upon that produced by Michel Bavin and downloaded from the CCS Compiler discussion forum
(2). The actual code is discussed in the Experimental Results section (with download links). However, some initial background about the Nokia 5110/PCD8544 controller from the datasheet in order to understand instruction registers, memory addressing etc is given in the following paragraphs.
Display RAM Addressing
The PCD8544 display RAM consists of 84 by 48 bits (X versus Y address), but the Y address is in the form of one byte at a time. This effectively then gives 84 columns (0 to 83 "X addresses") and 6 rows (0 to 5 "Y addresses"). This means you cannot address each pixel on the LCD screen individually. There are two "addressing" modes, vertical and horizontal, and the current X and Y address pointers within the PCD8544 are automatically incremented when data bytes are clocked-in. In horizontal mode, this means each byte is input into PCD8544 display RAM (LSB first) at the current X and Y position, and then the X address is automatically incremented. When the X address overflows at position 83, then the Y address is incremented (ie the next row is used). This is depicted in the following diagram. Conversely, with vertical addressing, the Y address is automatically incremented after each data byte first. When the Y address overflows (ie position 5) then the X address is incremented.
Since typically strings of letters/numbers are being displayed, the horizontal mode is most convenient. That is, each letter/number will automatically increment from left to right on the LCD screen. The addressing mode, along with a number of other allowable instructions, is set via a serial data stream with the bit pattern of each byte differentiating which instruction/options are being set.
The instruction set consists of two modes:
if D/C signal/pin is set LOW the byte is interpreted as a Command (see following diagram). In turn, there are two types of Command:
Basic Instruction Set - if "H" i.e. DB0, of the command byte=0
Extended Instruction Set - if "H" i.e. DB0, of the command byte=1
if D/C signal/pin is set HIGH the byte is interpreted as Data for PCD8544 RAM display
The datasheet in Section 8.1 advises that "attention should be paid to the possibility that the device may be damaged if not properly reset". It further then advises that the reset pulse (port B pin 1 in the following code) must be ‹0.3Vdd when Vdd reaches Vdd(min) or higher within a maximum time fo 100ms afater Vdd goes high. This means the function Nokia_Init() should be called early within the PIC code execution. Figure 16 shows the timing diagram for the reset/initiation function, but the datasheet doesn't actually list the timing requirements for the minimum/maximum time that the reset pin needs to be held low. The codes uses a time of 10msec which worked consistently. The originator of the base code
(2) advises that times less than 10msec also work, however, since start-up time is not particularly crucial to the applications in question, I haven't experimented with determining minimum workable timing. The most other relevent point from the data sheet in terms of initialisation is that the contents of all internal registers and RAM within the Nokia 5110/PDC8544 are undefined upon power-on. The remainder of the initialisation is to set the initial conditions for the internal registers (temperature coefficient, constrast level etc) and ensures that all pixels are off (all RAM locations set equal to zero).
Using the PDC8544 requires sending the relevent instructions via the "bit-banging" interface. As previously noted, there are two types of instructions, firstly, those that change the operational status of the PDC8544 controller, and secondly "write data" instructions which load information to the PDC8544 display RAM (i.e. set LCD pixels on or off). Changing the operational status of the PDC8544 is further differentiated into two sub-categories. Firstly, when bit DB0 of the command byte is set high (i.e. H=1 within the datasheet). This enables changing the temperature coefficient (required when the LCD will be operated in cold temperatures, to enable the LCD crystals to remain responsive at lower temperatures), the bais system (datasheet recommends Mux 1:48 so left this as is, didn't appear to make much of a difference) and the LCD screen contrast (Vop). These "H=1" instructions are mostly set during initisation and not routinely changed during ongoing operation.
The second sub-category of "operational instruction" is when bit DB0 of the command byte is set low (i.e. H=0 within the datasheet). This enables selection of types of display control (normal, inverse video, blank screen etc) and setting the X and Y location of RAM address pointers (which enables changing of particular pixels on the LCD screen). The functions and various compiler "defines" within the code library enable selection of the these functions as required by using bitwise arithmetic (i.e. bitwise AND to create the necessary bit pattern for the "command byte" to be send to the PCD8544). The most important item to remember is that particular functions are only available if the DB0 bit has been previously set appropriately. The library routines for changing RAM address pointers and display control assume that DB0 of the command byte has been previously set/sent as low. Therefore, if for example the LCD contrast is changed during PIC program operation (other than at initialisation using the code as written), the DB0 bit must be set and reset as appropriate.