LCD display program for PIC 16f877a Using Mikroc



"Hellow World!" on the first line and counting number on the second line. The image above is a screen capture of a simulation. I use the Proteus 7 VSM simulator to simulate my programs. 




Source code from Mikroc

//Test LCDchar *text = "Hello World!";
char mytext[3];
int i
;
void main() {


// pic16f887// ANSEL = 0x00; //Digital I/O for PORTA// ANSELH = 0x00; //Digital Input for PORTB
// pic16f877A
CMCON = 0x07;  //Set PORTA to Digital input
TRISB = 0;  // PORTB is output
TRISA = 0x07;  //PORTA as the input/output 0000 0111
i=0
;


Lcd_Init(&PORTB); // Initialize LCD connected to PORTB
Lcd_Cmd(Lcd_CLEAR); // Clear display
Lcd_Cmd(Lcd_CURSOR_OFF); // Turn cursor off
Lcd_Out(11text); // Print text to LCD, 2nd row
       while(1)


        {
               while(i<200)

             {
                 IntToStr(i,mytext);
                 Lcd_Out(2,1,mytext);
                 Delay_ms(500);
                 i++;
              }

            i=0;
        }



}

Post a Comment

Copyright © Rough Record. Designed by OddThemes