14 August 2012

LCD display program for PIC 16f877a Using Mikroc



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(1, 1, text); // 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;
        }


}

0 comments:

Post a Comment

Related Posts with Thumbnails

Popular Posts

 
;