PICマイコン XC8コンパイラにおけるUSARTの設定
少し前まで使用していたC18コンパイラにおいて、USARTの設定は次の通り記述していました。
html
1 OpenUSART(USART_TX_INT_OFF&USART_RX_INT_ON&USART_ASYNCH_MODE&USART_EIGHT_BIT&USART_CONT_RX&USART_BRGH_HIGH,25 );
XC8コンパイラを使用して、同じように設定したいのですが、どのように記述したら良いのか分かりません。
XC8に関する情報が少なく、困っております。
どなたか教えていただけると助かります。
##追加情報
http://blog.livedoor.jp/mplab/archives/1025058095.html
サイト(↑)を参考にしてコンパイルしています。
次のコードでコンパイルするとエラーがでてしまいます。
html
1#include <xc.h> 2#include "usart.h" 3 4// CONFIG1 5#pragma config FOSC = INTOSC // Oscillator Selection (INTOSC oscillator: I/O function on CLKIN pin) 6#pragma config WDTE = OFF // Watchdog Timer Enable (WDT disabled) 7#pragma config PWRTE = ON // Power-up Timer Enable (PWRT enabled) 8#pragma config MCLRE = ON // MCLR Pin Function Select (MCLR/VPP pin function is MCLR) 9#pragma config CP = OFF // Flash Program Memory Code Protection (Program memory code protection is disabled) 10#pragma config CPD = OFF // Data Memory Code Protection (Data memory code protection is disabled) 11#pragma config BOREN = ON // Brown-out Reset Enable (Brown-out Reset enabled) 12#pragma config CLKOUTEN = OFF // Clock Out Enable (CLKOUT function is disabled. I/O or oscillator function on the CLKOUT pin) 13#pragma config IESO = OFF // Internal/External Switchover (Internal/External Switchover mode is disabled) 14#pragma config FCMEN = OFF // Fail-Safe Clock Monitor Enable (Fail-Safe Clock Monitor is disabled) 15 16// CONFIG2 17#pragma config WRT = OFF // Flash Memory Self-Write Protection (Write protection off) 18#pragma config PLLEN = OFF // PLL Enable (4x PLL enabled) 19#pragma config STVREN = OFF // Stack Overflow/Underflow Reset Enable (Stack Overflow or Underflow will not cause a Reset) 20#pragma config BORV = HI // Brown-out Reset Voltage Selection (Brown-out Reset Voltage (Vbor), high trip point selected.) 21#pragma config LVP = OFF // Low-Voltage Programming Enable (High-voltage on MCLR/VPP must be used for programming) 22 23 24#define _XTAL_FREQ 8000000 //Clock=8MHz 25#define __delay(X) _delay((unsigned long)((X))) 26#define __delay_us(X) _delay((unsigned long)((X)*(_XTAL_FREQ/4000000UL))) //usec delay 27#define __delay_ms(X) _delay((unsigned long)((X)*(_XTAL_FREQ/4000UL))) //msec delay 28 29 30void main(void) { 31OSCCON=0x72; //PLL Disable/8MHz 32ANSELA=0x04; //RA2 Analog Setting 33ANSELC=0x00; //PORTC Digital Setting 34TRISA=0x02; //RA2 Input 35TRISC=0x28; //RC5, RC3 Input 36LATC=0x00; 37 38//RX, TX Port?? 39RXDTSEL = 0; // RC5?????? 40TXCKSEL = 0; // RC4?????? 41 42OpenUSART(USART_TX_INT_OFF&USART_RX_INT_OFF&USART_ASYNCH_MODE&USART_EIGHT_BIT&USART_CONT_RX&USART_BRGH_HIGH,51 ); 43 44while(1){ 45} 46}
エラーの内容は次の通りです。
このエラーがなぜ起きてしまうのかわかりません。
html
1nbproject/Makefile-default.mk:137: recipe for target 'dist/default/production/Test1.X.production.hex' failed 2make[2]: Leaving directory 'C:/Users/User01/MPLABXProjects/Test1.X' 3nbproject/Makefile-default.mk:90: recipe for target '.build-conf' failed 4make[1]: Leaving directory 'C:/Users/User01/MPLABXProjects/Test1.X' 5nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed 6make[2]: *** [dist/default/production/Test1.X.production.hex] Error 1 7make[1]: *** [.build-conf] Error 2 8make: *** [.build-impl] Error 2 9 10BUILD FAILED (exit value 2, total time: 1s) 11

バッドをするには、ログインかつ
こちらの条件を満たす必要があります。