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
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
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