/* * File: main.c * Author: user * * Created on 2021/11/23, 17:36 */ // PIC12F675 Configuration Bit Settings // 'C' source line config statements // CONFIG #pragma config FOSC = INTRCIO // Oscillator Selection bits (RC oscillator: CLKOUT function on GP4/OSC2/CLKOUT pin, RC on GP5/OSC1/CLKIN) #pragma config WDTE = OFF // Watchdog Timer Enable bit (WDT disabled) #pragma config PWRTE = ON // Power-Up Timer Enable bit (PWRT enabled) #pragma config MCLRE = ON // GP3/MCLR pin function select (GP3/MCLR pin function is MCLR) #pragma config BOREN = ON // Brown-out Detect Enable bit (BOD enabled) #pragma config CP = OFF // Code Protection bit (Program Memory code protection is disabled) #pragma config CPD = OFF // Data Code Protection bit (Data memory code protection is disabled) // #pragma config statements should precede project file includes. // Use project enums instead of #define for ON and OFF. #include #define _XTAL_FREQ 4000000 void main() { ADCON0 = 0; // A/D変換しない CMCON = 0x07; // コンパレータは使用しない ANSEL = 0; // アナログは使用しない(すべてデジタルI/Oに割当てる) TRISIO = 0b00000000; // ピンは全て出力に割当てる(GP3は入力のみとなる) GPIO = 0b00000000; // 出力ピンの初期化(全てLOWにする) // 500ms毎にLEDの点滅を繰り返す while(1) { GPIO2 = 1; // 5番ピン(GP2)にHIGH(5V)を出力する(LED ON) __delay_ms(500); GPIO2 = 0; // 5番ピン(GP2)にLOW(0V)を出力する(LED OFF) __delay_ms(500); } }