• Tin mới

    [PIC TUTORIAL] BÀI 15 Chương trình chớp tắt chu kỳ 1s các Led ở port C

    SƠ ĐỒ MẠCH ĐIỆN




    CHƯƠNG TRÌNH MẪU
    #include "16f887.h"
    #include "def_16f887.h"
    #fuses  NOWDT,NOPROTECT,PUT,NOLVP,XT 
    #use    delay(clock = 4000000)         //Tan so thach anh 4MHz
    
    void main()
    {
    
       setup_adc_ports(NO_ANALOGS|VSS_VDD);
       setup_adc(ADC_OFF);
       setup_spi(SPI_SS_DISABLED);
       setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
       setup_timer_1(T1_DISABLED);
       setup_timer_2(T2_DISABLED,0,1);
       setup_comparator(NC_NC_NC_NC);// This device COMP currently not supported by the PICWizard
    //Setup_Oscillator parameter not selected from Intr Oscillotar Config tab
    
    set_tris_c(0x00);    //PORTC xuat du lieu.
    PORTC = 0x00;        //Cac led deu tat.
       while(1)
          {
             PORTC = ~PORTC;
             delay_ms(1000);        
          }
    }
    

    DOWNLOAD FILE MÔ PHỎNG + CODE
    (Bấm vào link đợi 5s, sau đó bấm "Skip Ad" sẽ ra link download) 



    No comments