Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
1.2 kB
1
Indexable
Never
#include<16F877A.h>
#fuses XT, NOWDT, NOPROTECT, NOBROWNOUT, NOLVP, NOPUT, NOWRT, NODEBUG, NOCPD
#use delay(clock=4M)

#include<lcd.c>

void solaKaydir();

void main() 
{
   // lcd ekranini ac
   lcd_init();   
   
   /* lcd_putc();   icine yazilan stringi ekrana yaz
      lcd_gotoxy(); sutun, satira git
      delay_ms();   beklet */
   
   /* 1. Uygulama sagdan->sola */
   char firstLine[4][16] =  {"Erzincan",     "Serhat",    "201104077", "Hello,"};
   char secondLine[4][16] = {"Universitesi", "Karabulut", "Istanbul",  "World..!"};
   
   int counter = 0;
   
   delay_ms(600);
   
   for(int i=0;; i++)
   {
      if(i % 33 == 0)
      {
         if(counter == 4)
            counter = 0;
            
         // Ekrani temizle   
         lcd_putc("\f");
         // Bir sonraki kelime gurubunu ekrana yaz
         lcd_gotoxy(24,1);
         printf(lcd_putc, "%s", firstLine[counter]);
         lcd_gotoxy(24,2);
         printf(lcd_putc, "%s", secondLine[counter]);
         
         counter++;
      }
      
      delay_ms(300);
      solaKaydir();
     
      if(i == 33)
         i = 0;
   }     
}

void solaKaydir()
{
   lcd_send_byte(0,0x18); // sola kaydirma komutu
}