Lcd custom character with PIC Microcontroller and Mikro C
Welcome to MINA TECHNOLOGY.
In this tutorial will learn how to make Lcd custom character with PIC16F877A Microcontroller. Here I am use Mikro C Pro of PIC compiler for code editing. You can watch the video or read the written tutorial below.
Create a custom character use for LCD(Liquid Crystal Display). Up to eight characters of 5x8 pixels are supported.
Mikro C pro for PIC provide to create a custom character for LM16X2 Lcd display.
Circuit Diagram
Mikro C Code:
// LCD module connections
sbit LCD_RS at RB0_bit;
sbit LCD_EN at RB1_bit;
sbit LCD_D4 at RB2_bit;
sbit LCD_D5 at RB3_bit;
sbit LCD_D6 at RB4_bit;
sbit LCD_D7 at RB5_bit;
sbit LCD_RS_Direction at TRISB0_bit;
sbit LCD_EN_Direction at TRISB1_bit;
sbit LCD_D4_Direction at TRISB2_bit;
sbit LCD_D5_Direction at TRISB3_bit;
sbit LCD_D6_Direction at TRISB4_bit;
sbit LCD_D7_Direction at TRISB5_bit;
// End LCD module connections
const char character0[] = {14,14,4,14,21,4,10,17};
void CustomChar0() {
char i;
Lcd_Cmd(64);
for (i = 0; i<=7; i++) Lcd_Chr_CP(character0[i]);
Lcd_Cmd(_LCD_RETURN_HOME);
}
void main(){
Lcd_Init(); // Initialize lcd module
Lcd_Cmd(_LCD_CLEAR); // Lcd Clear
Lcd_Cmd(_LCD_CURSOR_OFF); // Lcd curosor off
Lcd_Out(1,3,"DEVELOPED BY");
Lcd_Out(2,1,"MINA TECHNOLOGY");
delay_ms(2000); //2s delay
Lcd_Cmd(_LCD_CLEAR);
Lcd_Out(1,3,"LCD CUSTOM");
delay_ms(100);
Lcd_Out(2,3,"CHARACTER");
delay_ms(2000);
Lcd_Cmd(_LCD_CLEAR);
CustomChar0();
while(1){
Lcd_Chr(1,1,0);
Lcd_Chr(2,16,0);
delay_ms(100);
Lcd_Cmd(_LCD_CLEAR);
Lcd_Chr(1,2,0);
Lcd_Chr(2,15,0);
delay_ms(100);
Lcd_Cmd(_LCD_CLEAR);
Lcd_Chr(1,3,0);
Lcd_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100);
Lcd_Cmd(_LCD_CLEAR);
Lcd_Chr(1,12,0);
Lcd_Chr(2,5,0);
delay_ms(100);
Lcd_Cmd(_LCD_CLEAR);
Lcd_Chr(1,11,0);
Lcd_Chr(2,6,0);
delay_ms(100);
Lcd_Cmd(_LCD_CLEAR);
Lcd_Chr(1,10,0);
Lcd_Chr(2,7,0);
delay_ms(100);
Lcd_Cmd(_LCD_CLEAR);
Lcd_Chr(1,9,0);
Lcd_Chr(2,8,0);
delay_ms(100);
Lcd_Cmd(_LCD_CLEAR);
Lcd_Chr(1,8,0);
Lcd_Chr(2,9,0);
delay_ms(100);
Lcd_Cmd(_LCD_CLEAR);
Lcd_Chr(1,7,0);
Lcd_Chr(2,10,0);
delay_ms(100);
Lcd_Cmd(_LCD_CLEAR);
Lcd_Chr(1,6,0);
Lcd_Chr(2,11,0);
delay_ms(100);
Lcd_Cmd(_LCD_CLEAR);
Lcd_Chr(1,5,0);
Lcd_Chr(2,12,0);
delay_ms(100);
Lcd_Cmd(_LCD_CLEAR);
Lcd_Chr(1,4,0);
Lcd_Chr(2,13,0);
delay_ms(100);
Lcd_Cmd(_LCD_CLEAR);
Lcd_Chr(1,3,0);
Lcd_Chr(2,14,0);
delay_ms(100);
Lcd_Cmd(_LCD_CLEAR);
Lcd_Chr(1,2,0);
Lcd_Chr(2,15,0);
delay_ms(100);
Lcd_Cmd(_LCD_CLEAR);
}
}
Click the download button for program file:
In this tutorial will learn how to make Lcd custom character with PIC16F877A Microcontroller. Here I am use Mikro C Pro of PIC compiler for code editing. You can watch the video or read the written tutorial below.
Create a custom character use for LCD(Liquid Crystal Display). Up to eight characters of 5x8 pixels are supported.
Mikro C pro for PIC provide to create a custom character for LM16X2 Lcd display.
Circuit Diagram
Mikro C Code:
// LCD module connections
sbit LCD_RS at RB0_bit;
sbit LCD_EN at RB1_bit;
sbit LCD_D4 at RB2_bit;
sbit LCD_D5 at RB3_bit;
sbit LCD_D6 at RB4_bit;
sbit LCD_D7 at RB5_bit;
sbit LCD_RS_Direction at TRISB0_bit;
sbit LCD_EN_Direction at TRISB1_bit;
sbit LCD_D4_Direction at TRISB2_bit;
sbit LCD_D5_Direction at TRISB3_bit;
sbit LCD_D6_Direction at TRISB4_bit;
sbit LCD_D7_Direction at TRISB5_bit;
// End LCD module connections
const char character0[] = {14,14,4,14,21,4,10,17};
void CustomChar0() {
char i;
Lcd_Cmd(64);
for (i = 0; i<=7; i++) Lcd_Chr_CP(character0[i]);
Lcd_Cmd(_LCD_RETURN_HOME);
}
void main(){
Lcd_Init(); // Initialize lcd module
Lcd_Cmd(_LCD_CLEAR); // Lcd Clear
Lcd_Cmd(_LCD_CURSOR_OFF); // Lcd curosor off
Lcd_Out(1,3,"DEVELOPED BY");
Lcd_Out(2,1,"MINA TECHNOLOGY");
delay_ms(2000); //2s delay
Lcd_Cmd(_LCD_CLEAR);
Lcd_Out(1,3,"LCD CUSTOM");
delay_ms(100);
Lcd_Out(2,3,"CHARACTER");
delay_ms(2000);
Lcd_Cmd(_LCD_CLEAR);
CustomChar0();
while(1){
Lcd_Chr(1,1,0);
Lcd_Chr(2,16,0);
delay_ms(100);
Lcd_Cmd(_LCD_CLEAR);
Lcd_Chr(1,2,0);
Lcd_Chr(2,15,0);
delay_ms(100);
Lcd_Cmd(_LCD_CLEAR);
Lcd_Chr(1,3,0);
Lcd_Chr(2,14,0);
delay_ms(100);
Lcd_Cmd(_LCD_CLEAR);
Lcd_Chr(1,4,0);
Lcd_Chr(2,13,0);
delay_ms(100);
Lcd_Cmd(_LCD_CLEAR);
Lcd_Chr(1,5,0);
Lcd_Chr(2,12,0);
delay_ms(100);
Lcd_Cmd(_LCD_CLEAR);
Lcd_Chr(1,6,0);
Lcd_Chr(2,11,0);
delay_ms(100);
Lcd_Cmd(_LCD_CLEAR);
Lcd_Chr(1,7,0);
Lcd_Chr(2,10,0);
delay_ms(100);
Lcd_Cmd(_LCD_CLEAR);
Lcd_Chr(1,8,0);
Lcd_Chr(2,9,0);
delay_ms(100);
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EAR);
Lcd_Chr(1,7,0);
Lcd_Chr(2,10,0);
delay_ms(100);
Lcd_Cmd(_LCD_CLEAR);
Lcd_Chr(1,6,0);
Lcd_Chr(2,11,0);
delay_ms(100);
Lcd_Cmd(_LCD_CLEAR);
Lcd_Chr(1,5,0);
Lcd_Chr(2,12,0);
delay_ms(100);
Lcd_Cmd(_LCD_CLEAR);
Lcd_Chr(1,4,0);
Lcd_Chr(2,13,0);
delay_ms(100);
Lcd_Cmd(_LCD_CLEAR);
Lcd_Chr(1,3,0);
Lcd_Chr(2,14,0);
delay_ms(100);
Lcd_Cmd(_LCD_CLEAR);
Lcd_Chr(1,2,0);
Lcd_Chr(2,15,0);
delay_ms(100);
Lcd_Cmd(_LCD_CLEAR);
}
}
Click the download button for program file:
download |
No comments