Mini servo program by pic16f877a

#pragma config FOSC = HS    // Oscillator Selection bits (HS oscillator)

#pragma config WDTE = ON    // Watchdog Timer Enable bit (WDT enabled)

#pragma config PWRTE = OFF   // Power-up Timer Enable bit (PWRT enabled)

#pragma config BOREN = OFF    // Brown-out Reset Enable bit (BOR enabled)

#pragma config LVP = OFF    // Low-Voltage (Single-Supply) In-Circuit Serial Programming Enable bit (RB3 is digital I/O, HV on MCLR must be used for programming)

#pragma config CPD = ON   // Data EEPROM Memory Code Protection bit (Data EEPROM code-protected)

#pragma config WRT = OFF   // Flash Program Memory Write Enable bits (Write protection off; all program memory may be written to by EECON control)

#pragma config CP = OFF   // Flash Program Memory Code Protection bit (Code protection off)


// #pragma config statements should precede project file includes.

// Use project enums instead of #define for ON and OFF.

#define _XTAL_FREQ 16000000

#include <xc.h>

int main()

{

  int i;


  TRISD=0X00;


  while(1){

    PORTD=0XFF;

     

    __delay_us(8500);

   PORTD=0X00;

    __delay_us(12500);

  

}

}

要查看或添加评论,请登录

社区洞察

其他会员也浏览了