質問編集履歴

1

追加情報を掲載しました。

2019/04/15 05:16

投稿

raspypy
raspypy

スコア247

test CHANGED
File without changes
test CHANGED
@@ -23,3 +23,145 @@
23
23
 
24
24
 
25
25
  どなたか教えていただけると助かります。
26
+
27
+
28
+
29
+ ##追加情報
30
+
31
+ http://blog.livedoor.jp/mplab/archives/1025058095.html
32
+
33
+ サイト(↑)を参考にしてコンパイルしています。
34
+
35
+
36
+
37
+ 次のコードでコンパイルするとエラーがでてしまいます。
38
+
39
+ ```html
40
+
41
+ #include <xc.h>
42
+
43
+ #include "usart.h"
44
+
45
+
46
+
47
+ // CONFIG1
48
+
49
+ #pragma config FOSC = INTOSC // Oscillator Selection (INTOSC oscillator: I/O function on CLKIN pin)
50
+
51
+ #pragma config WDTE = OFF // Watchdog Timer Enable (WDT disabled)
52
+
53
+ #pragma config PWRTE = ON // Power-up Timer Enable (PWRT enabled)
54
+
55
+ #pragma config MCLRE = ON // MCLR Pin Function Select (MCLR/VPP pin function is MCLR)
56
+
57
+ #pragma config CP = OFF // Flash Program Memory Code Protection (Program memory code protection is disabled)
58
+
59
+ #pragma config CPD = OFF // Data Memory Code Protection (Data memory code protection is disabled)
60
+
61
+ #pragma config BOREN = ON // Brown-out Reset Enable (Brown-out Reset enabled)
62
+
63
+ #pragma config CLKOUTEN = OFF // Clock Out Enable (CLKOUT function is disabled. I/O or oscillator function on the CLKOUT pin)
64
+
65
+ #pragma config IESO = OFF // Internal/External Switchover (Internal/External Switchover mode is disabled)
66
+
67
+ #pragma config FCMEN = OFF // Fail-Safe Clock Monitor Enable (Fail-Safe Clock Monitor is disabled)
68
+
69
+
70
+
71
+ // CONFIG2
72
+
73
+ #pragma config WRT = OFF // Flash Memory Self-Write Protection (Write protection off)
74
+
75
+ #pragma config PLLEN = OFF // PLL Enable (4x PLL enabled)
76
+
77
+ #pragma config STVREN = OFF // Stack Overflow/Underflow Reset Enable (Stack Overflow or Underflow will not cause a Reset)
78
+
79
+ #pragma config BORV = HI // Brown-out Reset Voltage Selection (Brown-out Reset Voltage (Vbor), high trip point selected.)
80
+
81
+ #pragma config LVP = OFF // Low-Voltage Programming Enable (High-voltage on MCLR/VPP must be used for programming)
82
+
83
+
84
+
85
+
86
+
87
+ #define _XTAL_FREQ 8000000 //Clock=8MHz
88
+
89
+ #define __delay(X) _delay((unsigned long)((X)))
90
+
91
+ #define __delay_us(X) _delay((unsigned long)((X)*(_XTAL_FREQ/4000000UL))) //usec delay
92
+
93
+ #define __delay_ms(X) _delay((unsigned long)((X)*(_XTAL_FREQ/4000UL))) //msec delay
94
+
95
+
96
+
97
+
98
+
99
+ void main(void) {
100
+
101
+ OSCCON=0x72; //PLL Disable/8MHz
102
+
103
+ ANSELA=0x04; //RA2 Analog Setting
104
+
105
+ ANSELC=0x00; //PORTC Digital Setting
106
+
107
+ TRISA=0x02; //RA2 Input
108
+
109
+ TRISC=0x28; //RC5, RC3 Input
110
+
111
+ LATC=0x00;
112
+
113
+
114
+
115
+ //RX, TX Port??
116
+
117
+ RXDTSEL = 0; // RC5??????
118
+
119
+ TXCKSEL = 0; // RC4??????
120
+
121
+
122
+
123
+ OpenUSART(USART_TX_INT_OFF&USART_RX_INT_OFF&USART_ASYNCH_MODE&USART_EIGHT_BIT&USART_CONT_RX&USART_BRGH_HIGH,51 );
124
+
125
+
126
+
127
+ while(1){
128
+
129
+ }
130
+
131
+ }
132
+
133
+ ```
134
+
135
+
136
+
137
+ エラーの内容は次の通りです。
138
+
139
+ このエラーがなぜ起きてしまうのかわかりません。
140
+
141
+
142
+
143
+ ```html
144
+
145
+ nbproject/Makefile-default.mk:137: recipe for target 'dist/default/production/Test1.X.production.hex' failed
146
+
147
+ make[2]: Leaving directory 'C:/Users/User01/MPLABXProjects/Test1.X'
148
+
149
+ nbproject/Makefile-default.mk:90: recipe for target '.build-conf' failed
150
+
151
+ make[1]: Leaving directory 'C:/Users/User01/MPLABXProjects/Test1.X'
152
+
153
+ nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed
154
+
155
+ make[2]: *** [dist/default/production/Test1.X.production.hex] Error 1
156
+
157
+ make[1]: *** [.build-conf] Error 2
158
+
159
+ make: *** [.build-impl] Error 2
160
+
161
+
162
+
163
+ BUILD FAILED (exit value 2, total time: 1s)
164
+
165
+
166
+
167
+ ```