Interfacing GLCD with PIC16F877A

Today I discuss on Interfacing GLCD with PIC16F877A. To overcome the limitation of LCD display we use GLCD (Graphical LCD). By using GLCD now we can display image draw line and shapes page by page which are not possible in normal LCD. So to know the process of Interfacing GLCD with PIC16F877A, We need to know the hardware connection as well as the some special instruction which is used in Mikroc Pro for Pic. Β In bellow you can see the hardware Interfacing GLCD with PIC16F877A in Proteous 7

 

Interfacing GLCD with PIC16F877A schematic

As shown in above circuit diagram you can easily connect your hardware. Now come with programming portion. For Interfacing GLCD with PIC16F877A we need to now some special library instruction of GLCD in MikroC Pro for pic. Those are discuss bellow

Initializes the Glcd module :

  • GLCD_CS1 : Chip select 1 signal pin
  • GLCD_CS2 : Chip select 2 signal pin
  • GLCD_RS : Register select signal pin
  • GLCD_RW : Read/Write Signal pin
  • GLCD_EN : Enable signal pin
  • GLCD_RST : Reset signal pin
  • GLCD_DataPort : Data port
  • GLCD_CS1_Direction : Direction of the Chip select 1 pin
  • GLCD_CS2_Direction : Direction of the Chip select 2 pin
  • GLCD_RS_Direction : Direction of the Register select signal pin
  • GLCD_RW_Direction : Direction of the Read/Write signal pin
  • GLCD_EN_Direction : Direction of the Enable signal pin
  • GLCD_RST_Direction : Direction of the Reset signal pin
Must be defined before using this function.
And command for initialization is Β Glcd_Init();
Β 

Selects Glcd side:

This command is basically used for selects the side of Glcd and command for that is Glcd_Select_Side(0);

Sets x-axis position: Β  Β  Β  Β  Β  Β  Β  Β  Β  Β 

This command is basically used for Sets x-axis positionΒ of Glcd and command for that is Glcd_Set_X(25);

Selects page of the Glcd:

This command is basically used for Selects page of the GlcdΒ and command for that is Glcd_Set_Page(5);

Reads data from the current location:

This command is basically used for Reads data from the current locationΒ of the GlcdΒ and command for that is

unsigned short data;
…

data = Glcd_Read_Data();

Writes one byte to the current location:

This command is basically used forΒ Writes one byte to the current location of the Glcd and command for that is

unsigned short data_;
…

Glcd_Write_Data(data_);

Β Clear screen:

This command is basically used for Clear screenΒ or fill the screen with 0/1 of the Glcd and command for is Glcd_Fill(0);

Β Draws a dot:

This command is basically used for Draws a dot at particular positionΒ of the GlcdΒ and command forthat is Glcd_Dot(0, 0, 2); .Β The parameter color determines a dot state: 0 clears dot, 1 puts a dot, and 2 inverts dot state and first tow digit is used forΒ x_pos and y_pos where you need the dot.

Β Draws a line:

This command is basically used for draw a line between dots (0,0) means (x=0,y=0) and (20,30) means (x=20,y=30) and command for that is

Glcd_Line(0, 0, 20, 30, 1);

The last digit in command is used for color of the lineΒ 0 white, 1 black, and 2 inverts each dot.

Draws a vertical line:

This command is basically used for draw a vertical line between dots (10,5) means (x=10,y=5) and (10,25) means (x=10,y=25) and command for that is

Glcd_V_Line(5, 25, 10, 1);

Β Draws a horizontal line:

This command is basically used for draw a horizontal line between dots (10,20) and (50,20) and command for that is

Glcd_H_Line(10, 50, 20, 1);

Draws a rectangle:

This command is basically used for draw a rectangle between dots (5,5) and (40,40) and command for that is

Glcd_Rectangle(5, 5, 40, 40, 1);

The last digit in command is used for color of the lineΒ 0 white, 1 black, and 2 inverts each dot.

Β Draws a box:

This command is basically used forΒ Draw a box between dots (5,15) and (20,40) and command for that is

Glcd_Box(5, 15, 20, 40, 1);

The last digit in command is used for color of the lineΒ 0 white, 1 black, and 2 inverts each dot.

Β Draws a circle:

This command is basically used forΒ Draw a circle with center in (50,50) and radius=10 and command for that is

Glcd_Circle(50, 50, 10, 1);

The last digit in command is used for color of the lineΒ 0 white, 1 black, and 2 inverts each dot.

Β Sets font Use :

This command is basically used forΒ The custom 5Γ—7 font β€œmyfont” which starts with space (32): and command for that is

Glcd_Set_Font(&myfont, 5, 7, 32);

Prints character :

This command is basically used forΒ Write character β€˜C’ on the position 10 inside the page 2:

Glcd_Write_Char(β€˜C’, 10, 2, 1);

The last digit in command is used for color of the lineΒ 0 white, 1 black, and 2 inverts each dot.

 

For more detail: Interfacing GLCD with PIC16F877A


About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.