You are on page 1of 1

sbit

sbit
sbit
sbit
sbit
sbit

LCD_RS
LCD_EN
LCD_D4
LCD_D5
LCD_D6
LCD_D7

at
at
at
at
at
at

RB4_bit;
RB5_bit;
RB0_bit;
RB1_bit;
RB2_bit;
RB3_bit;

sbit
sbit
sbit
sbit
sbit
sbit

LCD_RS_Direction
LCD_EN_Direction
LCD_D4_Direction
LCD_D5_Direction
LCD_D6_Direction
LCD_D7_Direction

at
at
at
at
at
at

TRISB4_bit;
TRISB5_bit;
TRISB0_bit;
TRISB1_bit;
TRISB2_bit;
TRISB3_bit;

char txt1[] = "Fan Off";


char txt2[] = "Fan On";
char i;
void Move_Delay() {
Delay_ms(500);
}
void main(){
TRISA=0X01;
TRISB=0X00;
PORTB=0X00;
Lcd_Init();
Lcd_Cmd(_LCD_CLEAR);
Lcd_Cmd(_LCD_CURSOR_OFF);
while(1){
if(PORTA == 0X01){
PORTB = 0X00;
DELAY_MS(100);
Lcd_Cmd(_LCD_CLEAR);
Lcd_Out(1,6,txt1);
Delay_ms(2000);
}
else
{
PORTB = 0X40;
DELAY_MS(100);
Lcd_Cmd(_LCD_CLEAR);
Lcd_Out(1,6,txt2);
Delay_ms(2000);
}
}
}

// Function used for text moving


// You can change the moving speed here

You might also like