วันจันทร์ที่ 2 เมษายน พ.ศ. 2561

Internal External OSC for beginner For PIC MPLAB X IDE ความถี่ภายในภายนอก และการใช้งานเบื้องต้น











Internal External OSC for beginner For PIC MPLAB X IDE ความถี่ภายในภายนอก และการใช้งานเบื้องต้น
2/4/2561 SONGCHAI PRAPATRUNGSEE
Internal External OSC for beginner For PIC MPLAB X IDE ความถี่ภายในภายนอก และการใช้งานเบื้องต้น


/*
 * File:   SHORT.c
 * Author: sc
 *
 * Created on 1 APRIL 2018, 18:47
 */

#include <xc.h>
//#define _XTAL_FREQ 4000000
//#pragma config FOSC = HSMP      // Oscillator Selection bits (HS oscillator (medium power 4-16 MHz))
#pragma config FOSC = INTIO67   // Oscillator Selection bits (Internal oscillator block)
#pragma config PLLCFG = ON      // 4X PLL Enable (Oscillator multiplied by 4)
void DELAY_MS(unsigned int TIME){//DELAY HAVE INPUT
unsigned int i,j;
for(i=0;i<TIME;i++)
for(j=0;j<23;j++);//MODIFY TIME THIS ROW
}
void main(void) {
TRISA=0;  
while(1){
PORTA=0XF0;
DELAY_MS(2000);
//__delay_ms(500);
PORTA=0X0F;
DELAY_MS(2000);
//__delay_ms(500);
}

}




ไม่มีความคิดเห็น: