You are on page 1of 1

// Lcd pinout settings

sbit LCD_RS at RB4_bit;


sbit LCD_EN at RB5_bit;
sbit LCD_D7 at RB3_bit;
sbit LCD_D6 at RB2_bit;
sbit LCD_D5 at RB1_bit;
sbit LCD_D4 at RB0_bit;

// Pin direction
sbit LCD_RS_Direction at TRISB4_bit;
sbit LCD_EN_Direction at TRISB5_bit;
sbit LCD_D7_Direction at TRISB3_bit;
sbit LCD_D6_Direction at TRISB2_bit;
sbit LCD_D5_Direction at TRISB1_bit;
sbit LCD_D4_Direction at TRISB0_bit;

const char character[] = {0,14,17,27,17,21,17,14};

void CustomChar(char pos_row, char pos_char) {


char i;
Lcd_Cmd(64);
for (i = 0; i<=7; i++) Lcd_Chr_CP(character[i]);
Lcd_Cmd(_LCD_RETURN_HOME);
Lcd_Chr(pos_row, pos_char, 0);
}
int i,j,cn=0;
void main(){
trisb=0;
trisc=1;
portb=0;
portc=0;
Lcd_Init();

Lcd_Cmd(_LCD_CURSOR_OFF);
Lcd_Out(1,6,"WELCOME");
Lcd_Out(2,3,"Happy New Year");
while(1){

if(portc.f0 ==1&& i==0){


i=1;
Lcd_Cmd(_LCD_CLEAR);
}
if(portc.f0==0 && i==1){
i=0;
}
if(portc.f1 ==1&& j==0){
j=1;
Lcd_chr(2,3,'I');
CustomChar(2,5);
Lcd_Out(2,7,"ECE");
}
if(portc.f1==0 && j==1){
j=0;
}
}

You might also like