Introduction
Nokia 5510 LCD Module is 84x48 monochrome graphical LCD that use a Philip PCD8544 pixel matrix LCD controller/driver. It is very easy to use since it uses only three wires SPI interface with some additional control pin. It configuration setting is simple that is very similar to the KS0108 LCD controller except the three wires SPI interface. Using this interface is easy to connect and maintenance with a master MCU.
![]() |
| Program Testing |
This graphical LCD is widely available at very low cost. Most electronic hobbyists use this LCD with an Arduino. However different micro-controllers can control this display via a dedicated or software SPI.
dsPIC30F2010 and Nokia 5110 LCD Programming using MikroC
MikroC doesn't have a build-in library for this LCD module. But it has both hardware and software SPI to communicate with any devices. Hardware or dedicated SPI is very fast even at the speed of Fosc/4 of a micro-controller clock.
![]() |
| Program Testing |
I can not properly configure the hardware SPI module of the dsPIC30F2010 at this time. So I use its software SPI library instead due to its select-able pins and lower transmission speed. Commonly the Nokia 5110 LCD is unable to operates at high clock frequency. It should be below 500kbps.
Schematic:
![]() |
| Schematic Diagram |
In this example, I use this LCD to shows some texts on screen. I can not put any additional graphic due to its limited ROM. The dsPIC30F2010 has only 12kBytes of ROM space.
MikroC Source Code:
#include "font.c"- sbit Chip_Select at LATE0_bit;
- sbit SoftSpi_CLK at LATE1_bit;
- sbit SoftSpi_SDI at RE2_bit;
- sbit SoftSpi_SDO at LATE3_bit;
- sbit RST at LATE4_bit;
- //sbit CS at LATE5_bit;
- sbit D_C at LATE5_bit;
- sbit Chip_Select_Direction at TRISE0_bit;
- sbit SoftSpi_CLK_Direction at TRISE1_bit;
- sbit SoftSpi_SDI_Direction at TRISE2_bit;
- sbit SoftSpi_SDO_Direction at TRISE3_bit;
- sbit RST_Direction at TRISE4_bit;
- //sbit CS_Direction at TRISE5_bit;
- sbit D_C_Direction at TRISE5_bit;
- #define LCD_C 0
- #define LCD_D 1
- #define LCD_X 84
- #define LCD_Y 48
- void LcdCharacter( char charactor);
- void LcdClear(void);
- void LcdInitialize(void);
- void LcdString( char *charactor);
- void LcdWrite( char dc,unsigned char _data);
- void setXy(char x,char y);
- void main() {
- LcdInitialize();
- LcdClear();
- setXy(0,0);
- LcdString("MikroC dsPIC");
- setXy(0,1);
- LcdString("Nokia 5510");
- setXy(0,2);
- LcdString("Monochrome");
- setXy(0,3);
- LcdString("LCD Example");
- setXy(0,4);
- LcdString("dsPIC30F2010");
- setXy(0,5);
- LcdString("16-bit MCU");
- while(1){
- }
- }
- void LcdCharacter( char character){
- int i;
- LcdWrite(LCD_D,0x00);
- for(i=0;i<5;i++) LcdWrite(LCD_D,ASCII[character-0x20][i]);
- LcdWrite(LCD_D,0x00);
- }
- void LcdClear(void){
- int i;
- for(i=0;i<LCD_X*LCD_Y/8;i++) LcdWrite(LCD_D,0x00);
- }
- void LcdInitialize(void){
- Chip_Select_Direction = 0; // Set CS# pin as Output
- RST_Direction = 0;
- D_C_Direction = 0;
- Soft_SPI_Init(); // Initialize Soft_SPI
- RST=0;
- RST=1;
- Chip_Select=1;
- LcdWrite(LCD_C,0x21); // LCD Extended Commands
- LcdWrite(LCD_C,0xB0); // SET LCD CONTRAST
- LcdWrite(LCD_C,0x04); // set temp coefficient 0x04
- LcdWrite(LCD_C,0x14); // LCD bias 1:48 0x13
- LcdWrite(LCD_C,0x20);
- LcdWrite(LCD_C,0x0C); // LCD normal Mode
- }
- void LcdString( char *character){
- while(*character) LcdCharacter(*character++);
- }
- void LcdWrite( char _dc, char _data){
- D_C =_dc;
- Chip_Select=0;
- Soft_SPI_Write(_data);
- Chip_Select=1;
- }
- /*Set the cursor*/
- void setXy(char x,char y){
- /*x ranges from 0 to 83*/
- LcdWrite(LCD_C, 0x80+(6*x));
- /*y ranges from 0 to 5*/
- LcdWrite(LCD_C, 0x40+y);
- }
I tested this example, on my DIY dsPIC30F2010 Prototype Board. The LCD dots is not clear due to its poor quality.
















