You have no items in your shopping cart.

Subtotal: 0.00

PIC16F/18F Advanced Development Board

is specifically designed to help students to master the required skills in the area of embedded systems. The kit is designed in such way that all the possible features of the microcontroller will be easily used by the students. The kit supports in system programming (ISP) which is done through USB port.

Microchip’s PIC (PIC16F877A), PIC16F/18F Advanced Development Board Kit is proposed to smooth the progress of developing and debugging of various designs encompassing of High speed 8-bit Microcontrollers

GLCD (Graphical Liquid Crystal Display)

The Graphics LCD as the name suggests is a type of LCD which can display graphics. The graphical representation of any data presents good understanding than just characters. More user friendly applications can be designed by using the graphical LCDs.

Interfacing GLCD

Fig. 1 shows how to interface the GLCD to microcontroller. The 128X64 Graphical LCD interfaces to adjust contrast through trim pot. The GLCD needed to create 8-bit interface; 8 data bits (D0 – D7), three control lines, address bit (RS), read/write bit (R/W) and control signal (E), Page Select (CS).



Fig. 1 Interfacing GLCD to Microcontroller

Fig. 1 Interfacing GLCD to Microcontroller

 

Interfacing GLCD with PIC16F877A

We now want to display a text in

PIC16F/18F Advanced Development Board

by using GLCD module. The

PIC16F/18F Advanced Development Board

has numbers of GLCD connections, connected with I/O Port lines (PORTE.0 – PORTE.2 & PORTD.0 – PORTD.7) to make GLCD display.

Pin Assignment with PIC16F877A

 

 

GLCD/LCD

PIC16F/18F

LCD | 128x64 GLCD Selection

CONTROL L LINES

RS

PORTE.0

                          LCD | 128x64 GLCD Selection

R/W

PORTE.1

E

PORTE.2

LCD – DATA LINES

DB0

PORTD.0

DB1

PORTD.1

Connections

DB2

PORTD.2

*Connect PORTD with JP9 (LCD) via FRC Cable

 

*Place a Jumper on BL-SEL (J7) to Enable Backlight

 

*Press RESET Once.

 

*Adjust the POT (CONTRAST) Right or Left until the     

   letters are visible

DB3

PORTD.3

DB4

PORTD.4

DB5

PORTD.5

DB6

PORTD.6

DB7

PORTD.7

Output:  The Strings “PIC DEV. BOARD” and "LCD DEMO PROGRAM" will be displayed on LCD.

 

Circuit Diagram to Interface GLCD with PIC16F



Circuit Diagram to Interface GLCD with PIC16F

Source Code

The Interfacing GLCD with PIC16F877A program is very simple and straight forward, which display a text in 128 X 64 GLCD modules. Some delay is occurring when a single command / data is executed. In C programs you cannot be sure of delay, because it depends on compiler how it optimizes the loops as soon as you make changes in the options the delay changes.

C Program to display a text in GLCD using PIC16F

***************************************************************************************

Title : Program to GLCD display

*************************************************************************************

#include

__CONFIG(0x3f72);

#define CS1 RA4

#define CS2 RA5

#define RS RA1

#define RW RA2

#define E RA3

#define DATA PORTD void DelayMs(unsigned int);

void GLCD_Init(void);

void GLCD_Comd(unsigned char);

void GLCD_Data(unsigned char);

void GLCD_PutPicture(const unsigned char *);

void Select_page(unsigned char);

void GLCD_ClrScr(void);

unsigned int Page=0,i=0;

unsigned int Column=0;

const unsigned char carsun_bmp[1024] ={ 0, 0, 0, 0, 4, 10, 58, 62,122,210,208,208,208,208,208, 48, 188, 60,172,172,246,247,255,110,254,190,126, 126, 92,152, 96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128,128,128,128,0,129,129,141,143,136, 192, 80,208,200, 8, 8, 140, 12, 58, 58, 71,130,135, 0,161,208,112,240,160,166,166,153, 139,142,141,143, 15, 27, 23, 23, 27, 15,15, 143,190,187,191,159,204,140,143,246, 246,246,230,189,255,177,189,238,195, 76, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 28,222, 126,123, 57, 63,125,120, 15, 15, 3, 3, 65,193,225,193,192,192, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 98, 99, 29, 153,192, 66,199,132,132,133,135, 0, 0,128, 80,120, 81,113,118,126, 63, 31, 22,227,253, 248,224, 192,193,194,194,194,195,129, 0, 1,131,131, 191,191,230,234,234,188,248,241,195, 66, 71, 129,133,133,174,255,255,247,255,255,254, 254,255,251,253,210,208, 0, 0, 0, 0, 0, 0, 32, 60, 52,247,254,241,245,239,255,188,182,254, 52,230,243,233,247,151,153,255,247,243,223, 221,252,120,120,248, 104,120,248,112,112, 48, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 16, 16, 16, 16, 16, 16, 16, 16, 16, 31, 31, 31, 31, 17, 17, 17, 17, 17, 17, 17, 18, 18, 25, 25, 44, 15, 31, 63, 63,111,127, 58, 63,119,119,255,191, 53, 22, 31, 11, 31, 31, 47, 63, 63,255,207,255,255, 47, 37, 0, 0, 0, 0, 0, 0, 0, 32,251,255,255,255,255,255, 131, 129,193, 227,227, 51, 55,229,199, 7, 15, 11, 27, 31, 28, 56,240, 96, 96, 97, 97, 97, 97, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,224, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 97, 99, 98,102,108,248,240, 96, 96, 0,255,255,255,255, 0, 0, 0, 0, 0, 0, 0, 2, 23, 29, 33, 33,255,255,255,255,167,167, 58, 24,120,248,232,121,123,122,158,144, 0,252,158,159,127, 96,128, 14, 10, 10, 10, 10, 10, 10, 14, 0, 0, 0, 14, 10, 10, 10, 10, 10, 14, 14, 0, 0,128,255,248,232,192,192,254, 254,254,34, 34, 34, 34, 34, 34,254, 34, 34, 34, 34, 34, 34, 34,254,254,254, 50, 0,0, 0,254,130, 186, 58, 58, 98, 98, 98, 98, 2,254, 0, 0, 0,254,254,254,254, 34, 34, 34, 34,254,254, 34, 34, 34, 34, 34,254,254,254,224,127,255,194,222, 126,255,255,255,255, 0, 0, 0, 0, 0, 0, 0, 0,128,128,128, 96,191,255,127,255,255,225,195, 207,140,137, 8, 8, 8, 8, 25, 63, 59, 11, 79, 79, 73,233,254, 168,160,160, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 60, 63, 39, 47, 63, 63,125, 73, 9,225, 64, 72, 120,120,120,121, 73, 65, 77, 81, 25,121, 73,121, 49,113, 73, 73,200,200,120,127, 80, 81, 64, 64, 64, 80, 80,240,224,127, 24,152, 144,201,233, 249,249, 56,136, 8,144,241,121,120,160,248,240, 112, 9,121, 63,127,120,104, 77, 76,124,255,255, 255,255,248, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 3, 3, 3, 6, 6, 12, 12, 24, 24, 16, 48, 32, 96, 96, 192,192,128,128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 2, 6, 6, 0, 0, 4, 0, 0, 2, 2, 34, 98, 98,208,209, 145, 145, 16, 16, 16, 8, 8, 8, 4, 6, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128,128,192,192,224,224,248,231,239,255,119,67, 0, 0, 0, 0, 0, 0, 0, 0, 0,128,128,0,192, 192,192,192,192,192, 192,192,192,192,192,192, 192,192,192,192,192,192,192, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 96, 64, 64, 65, 65, 99, 99, 98,102,102,108, 108,120,120,120,112,112, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,1, 1, 3, 2, 6, 6, 12, 12, 24, 24, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 16, 16, 0, 0, 0, 0, 0, 0};

void main(void)

{

DelayMs(100);

ADCON1= 7;

TRISA = 0;

TRISD = 0x00;

DelayMs(50);

GLCD_Init();

DelayMs(100);

while(1)

{

GLCD_ClrScr();

DelayMs(1000);

GLCD_PutPicture(carsun_bmp);

DelayMs(1000);

}

}

void GLCD_Init()

{

unsigned char Comd[5]={0xc0,0xb8,0x40,0x3f};

Select_page(1);

for(i=0;i<4;i++)

GLCD_Comd(Comd[i]);

Select_page(0);

for(i=0;i<4;i++)

GLCD_Comd(Comd[i]);

}

void Select_page(unsigned char Page)

{

if(Page==1)

{

CS1=0; CS2=1;

}

else

{

CS1=1;

CS2=0;

}

}

void GLCD_Comd(unsigned char command)

{

RS=0;

RW=0;

E=1;

DATA=command;

E=0;

}

void GLCD_Data(unsigned char data)

{

RS=1;

RW=0;

E=1;

DATA=data;

E=0;

}

void GLCD_PutPicture(const unsigned char *ip)

//Change here for method 1,2 and 3

{

for (Page = 0; Page < 8; Page++)

{

Select_page(1);

GLCD_Comd(0xb8 | Page);

GLCD_Comd(0x40);

for (Column = 0;

Column < 128; Column++)

{

if (Column == 64)

{

Select_page(0);

GLCD_Comd(0xb8 | Page);

GLCD_Comd(0x40);

}

GLCD_Data(*ip++);

//This is Method 3

}

}

}

void GLCD_ClrScr(void)

{

for (Page = 0; Page < 8; Page++)

{

Select_page(1);

GLCD_Comd(0xb8 | Page);

GLCD_Comd(0x40);

for (Column = 0;

Column < 128; Column++)

{

if (Column == 64)

{

Select_page(0);

GLCD_Comd(0xb8 | Page);

GLCD_Comd(0x40);

}

GLCD_Data(0x00);

//This is Method 3

}

}

}

void DelayMs(unsigned int Ms)

{

int delay_cnst; while(Ms>0)

{

Ms--;

for(delay_cnst = 0;delay_cnst <220;delay_cnst++);

}

}

To compile the above C code you need the Mplab software & Hi-Tech C Compiler. They must be properly set up and a project with correct settings must be created in order to compile the code. To compile the above code, the C file must be added to the project.

In Mplab, you want to develop or debug the project without any hardware setup. You must compile the code for generating HEX file. In debugging Mode, you want to check the port output without microcontroller Advanced Development Board .

The PICKIT2 software is used to download the hex file into your microcontroller through USB.

Testing the Graphical LCD Module with PIC16F877A

Give +12V power supply to

PIC16F/18F Advanced Development Board

the Graphical LCD is connected with microcontroller PIC16F/18F Board. When the program is downloading into

PIC16F877A in Advanced Development Board, the screen should show the image output.

If you are not getting any output from Graphical LCD, then you just check the jumper connections & adjust the trim pot level. Otherwise you just check it with debugging mode in Mplab. If you want to see more details about debugging just see the videos in below link.

How to Create & Debug a Project in Mplab using PIC16F using Hi-Tech Compiler.

General Information

☞For proper working use the components of exact values as shown in Circuit file.

☞Solder everything in a clean way. A major problem arises due to improper soldering, solder jumps and loose joints.

☞Use the exact value crystal shown in schematic.

☞More instructions are available in following articles,

PIC Advanced Development board

User Manual for PIC 16F/18F Advanced Development Kit

Interfacing LCD with PIC16F877A.