May 26, 2014

PIC16F877A - MIKRO C - LCD



1)  To print data on lcd
 void main()
                              {
                               lcd_init(&portd);    //sets the port “d” as lcd output
                              lcd_cmd(lcd_clear);  //clearing  of screen
                              lcd_cmd(lcd_cursor_off);  //to off the cursor
                              lcd_out(1,2,"hh");  // print the word “hh” starting on the 1st row and second column

                              }
2) Changing  word in lcd on switch press
    void main()
                              {
                               lcd_init(&portd);
                              lcd_cmd(lcd_clear);
                              lcd_cmd(lcd_cursor_off);
                              trisb.f0=1;
                              while  (1)
                              {
                              if(portb.f0==1)   // when switch is  pressed
                              {
                              lcd_out(1,2,"kollam");
                              delay_ms(500);
                              lcd_cmd(lcd_clear);
                              }
                             while(portb.f0==0)  //when switch is not pressed
                              {
                              lcd_out(1,2,"pott");
                               }

                              }  }