Metin ÖZTÜRK

  • Anasayfa
  • Favorilere Ekle
  • Site Haritası

 

Takvim

Micro C Program Örnekleri

Aşağıda Micro C ile kodları verilmiş devreleri Proteus programı kullanılarak çizilmiştir. Devre şemalarını kopyalayıp yapıştır şeklinde alarak büyütüp daha iyi görüntü sağlayabilirsiniz. 


1-      1 Adet LED yakıp söndürmek.





void main ( )
{

TRISA=0B00000000;

PORTA=0;

while (1)

   {

   PORTA.RA0=1;

   DELAY_MS(1000);

   PORTA.RA0=0;

   DELAY_MS(1000);

   }

}


2-      Sırayla 8 adet LED yakıp söndürmek.



void main ()

TRISB=0B00000000;

PORTB = 0;

CMCON = 7;

While( 1 )
{

   PORTB = 0B00000001;

   DELAY_MS(100);

   PORTB = 0B00000010;

   DELAY_MS(100);

   PORTB = 0B00000100;

   DELAY_MS(100);

   PORTB = 0B00001000;

   DELAY_MS(100);

   PORTB = 0B00010000;

   DELAY_MS(100);

   PORTB = 0B00100000;

   DELAY_MS(100);

   PORTB = 0B01000000;

   DELAY_MS(100);

   PORTB = 0B10000000;

 

   PORTB = 0B10000000;

   DELAY_MS(100);

   PORTB = 0B01000000;

   DELAY_MS(100);

   PORTB = 0B00100000;

   DELAY_MS(100);

   PORTB = 0B00010000;

   DELAY_MS(100);

   PORTB = 0B0001000;

   DELAY_MS(100);

   PORTB = 0B00000100;

   DELAY_MS(100);

   PORTB = 0B00000010;

   DELAY_MS(100);

   PORTB = 0B00000001;

}

3-      Trafik Sinyali yapma.





void main ( ) 
{

TRISA =0B00000000;

PORTA=0;

CMCON=7;

 

while (1)
{

   PORTA.RA0=1;

   DELAY_MS(3000);

    PORTA.R0=0;

 

   PORTA.RA1=1;

   DELAY_MS(1500);

   PORTA.R1=0;

 

   PORTA.RA2=1;

   DELAY_MS(2000);

   PORTA.R2=0;

   }
}


4-      If komutu ile 2 LED çalışması.





void main ( ) 
{

   TRISA=0;

   TRISB=0B00000000;

   CMCON=7;

   PORTA=0;

   PORTB=0;

   PORTA.RA0=1;

   while(1);

         {

         if  (PORTA.RA0=1);

            {

              DELAY_MS(2000);

              PORTB.RB0=1;

              }

         if   (PORTB.RB0=1);

              {

               DELAY_MS(2000);

               PORTB.RB0=0;

               DELAY_MS(2000);

               PORTA.RA0=0;

               DELAY_MS(2000);

               }

          }

}


Ziyaret Bilgileri
Aktif Ziyaretçi1
Bugün Toplam14
Toplam Ziyaret56081
Döviz Bilgileri
AlışSatış
Dolar27.085027.1935
Euro28.828128.9436