###前提・実現したいこと
PICkit3とPIC16F887を使ってLチカをしたいのですが、
プログラムを書き込んでも、うまくいきません。
ご教授お願いします。
###発生している問題・エラーメッセージ
LEDが点かない
###該当のソースコード
* File: main.c * Author: *** * * Created on 2016/09/09, 17:17 */ #include <stdio.h> #include <stdlib.h> #include <xc.h> // PIC16F887 Configuration Bit Settings // 'C' source line config statements // CONFIG1 #pragma config FOSC = EXTRC_CLKOUT// Oscillator Selection bits (RC oscillator: CLKOUT function on RA6/OSC2/CLKOUT pin, RC on RA7/OSC1/CLKIN) #pragma config WDTE = ON // Watchdog Timer Enable bit (WDT enabled) #pragma config PWRTE = OFF // Power-up Timer Enable bit (PWRT disabled) #pragma config MCLRE = ON // RE3/MCLR pin function select bit (RE3/MCLR pin function is MCLR) #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 BOREN = ON // Brown Out Reset Selection bits (BOR enabled) #pragma config IESO = ON // Internal External Switchover bit (Internal/External Switchover mode is enabled) #pragma config FCMEN = ON // Fail-Safe Clock Monitor Enabled bit (Fail-Safe Clock Monitor is enabled) #pragma config LVP = OFF // Low Voltage Programming Enable bit (RB3 pin has digital I/O, HV on MCLR must be used for programming) // CONFIG2 #pragma config BOR4V = BOR40V // Brown-out Reset Selection bit (Brown-out Reset set to 4.0V) #pragma config WRT = OFF // Flash Program Memory Self Write Enable bits (Write protection off) // #pragma config statements should precede project file includes. // Use project enums instead of #define for ON and OFF. #define XTAL_FREQ 4000000 /* * */ int main(int argc, char** argv) { TRISD = 0; //RDをOUTPUTに char st=0; while(1); { if(st==0) { PORTDbits.RD1 = 0; //PORTD = 0; st = 1; } else { PORTDbits.RD1 = 1; //PORTD = 0x02; st = 0; } _delay(2000000); } }
###補足情報(言語/FW/ツール等のバージョンなど)
言語 C
コンパイラー XC8
書き込み MPLAB IPE + PICkit3
回答2件
あなたの回答
tips
プレビュー
下記のような回答は推奨されていません。
このような回答には修正を依頼しましょう。