13 Haziran 2018 Çarşamba

Karaşimşek yürüyen ışık devresi

Devre aslında ileri geri yürüyen ışık devreside denir.12voltl'a çalışır ve 7805 regüle entegresiyle gerilim 5volt'a düşürülerek pıc16F877 entegresini besler. Bu devrenin kodlarını değiştirerek sadece ileri veya sadece geri yürüyen ışık olarak da kullanılabilir.

MALΖEME LİSTESİ:

1-7805
2-4MHz kristal
3-2adet 22pf
4-100nf
5-4k7
6-8adet 330hom
7-kırmızı LED
8-16F877

DEVRE ŞEMASI:













CCSC KODU:
#include <16F877.h>     
#fuses XT,NOWDT,NOPROTECT,NOBROWNOUT,NOLVP,NOPUT,NOWRT,NODEBUG,NOCPD 
#use delay(clock=4000000)  

void main ()

{   
   setup_psp(PSP_DISABLED);        
   setup_timer_1(T1_DISABLED);     
   setup_timer_2(T2_DISABLED,0,1); 
   setup_adc_ports(NO_ANALOGS);    
   setup_adc(ADC_OFF);             
   setup_CCP1(CCP_OFF);            
   setup_CCP2(CCP_OFF);            
     
   set_tris_b(0b000000);
   output_b(0x00);
   
   while(1) 
 { 
       output_high(PIN_b0);    
       delay_ms(20);
       output_low(PIN_b0);            
       delay_ms(1);
       output_high(PIN_b1);    
       delay_ms(20);
       output_low(PIN_b1);            
       delay_ms(1);
       output_high(PIN_b2);    
       delay_ms(20);
       output_low(PIN_b2);            
       delay_ms(1);
       output_high(PIN_b3);    
       delay_ms(20);
       output_low(PIN_b3);            
       delay_ms(1);
       output_high(PIN_b4);    
       delay_ms(20);
       output_low(PIN_b4);            
       delay_ms(1);
       output_high(PIN_b5);    
       delay_ms(20);
       output_low(PIN_b5);            
       delay_ms(1);
       output_high(PIN_b6);    
       delay_ms(20);
       output_low(PIN_b6);            
       delay_ms(1);
       output_high(PIN_b7);    
       delay_ms(20);
       output_low(PIN_b7);            
       delay_ms(1);
       
       output_high(PIN_b7);    
       delay_ms(20);
       output_low(PIN_b7);            
       delay_ms(1);
       output_high(PIN_b6);    
       delay_ms(20);
       output_low(PIN_b6);            
       delay_ms(1);
       output_high(PIN_b5);    
       delay_ms(20);
       output_low(PIN_b5);            
       delay_ms(1);
       output_high(PIN_b4);    
       delay_ms(20);
       output_low(PIN_b4);            
       delay_ms(1);
       output_high(PIN_b3);    
       delay_ms(20);
       output_low(PIN_b3);            
       delay_ms(1);
       output_high(PIN_b2);    
       delay_ms(20);
       output_low(PIN_b2);            
       delay_ms(1);
       output_high(PIN_b1);    
       delay_ms(20);
       output_low(PIN_b1);            
       delay_ms(1);
       output_high(PIN_b0);    
       delay_ms(20);
       output_low(PIN_b0);            
       delay_ms(1);             
   }

}




Hiç yorum yok:

Yorum Gönder