MPLAB X C30 compile ไม่ได้ครับ

Started by pumpuykung, June 13, 2016, 04:52:04 PM

Previous topic - Next topic

pumpuykung




ผมคอมไพล์แล้วคอมไพล์ไม่ผ่านครับ ขึ้น error
CLEAN SUCCESSFUL (total time: 110ms)
make -f nbproject/Makefile-default.mk SUBPROJECTS= .build-conf
make[1]: Entering directory 'D:/NECTEC Work/dspic30f/dspic project/read i2c.X'
make[1]: *** No rule to make target '.build-conf'.  Stop.
make[1]: Leaving directory 'D:/NECTEC Work/dspic30f/dspic project/read i2c.X'
nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed
make: *** [.build-impl] Error 2

BUILD FAILED (exit value 2, total time: 161ms)
จะต้องแก้ยังไงครับ

ส่วนนี้จะเป็นโค๊ดที่ใช้โมดูล I2C กับไอซี PCF8574A
#include <p30f6014a.h>
#include "i2c.h"

_FOSC(CSW_FSCM_OFF & XT_PLL4);
_FGS(CODE_PROT_OFF);
_FWDT(WDT_OFF);

#define TRUE            1
#define PCF8574A_ID     0x70    // 0111[000]0 , PCF8574A Slave
                                // Address(bit 1-3)

// MI2C Interrupt
void _ISR _MI2CInterrupt(void)
{
    _MI2CIF = 0; //Clear Master I2C Interrupt
}
// Delay 1 ms (XT w/PLL 4x)
void Delay_ms(unsigned int ms)
{
    unsigned int i ;
    for(; ms>0 ; ms--)
        for(i=0;i<728;i++)
            Nop();  //deay 1 mch cycle
}

// Initialize Master I2C
void Init_MI2C(void)
{
    unsigned int config1, config2 ;
    _TRISG2 = 1;    //SCL Port
    _TRISG3 = 1;    //SDA Port
   
    // configuration I2C for 7 bits address mode
    config1 = (I2C_ON &             // I2C module enable
               I2C_IDLE_CON &       // continue I2C module in Idle mode
               I2C_CLK_HLD  &       // hold clock
               I2C_IPMI_DIS &       // IPMI mode disable
               I2C_7BIT_ADD &       // I2CADD is 7 bits address
               I2C_SLW_DIS  &       // disable slew rate control
               I2C_SM_DIS   &       // disable SM bus specification
               I2C_GCALL_DIS &      // disable general call address
               I2C_STR_DIS  &       // disable clock stretching
               I2C_ACK      &       // Transmit 0 to sent ACK
               I2C_RCV_DIS  &       // receive sequence not process
               I2C_STOP_DIS &       // stop condition idle
               I2C_RESTART_DIS &    // restart condition idle
               I2C_START_DIS &);    // start condition idle
   
    config2 = 40 ;                  // configuration I2C baud rate at 100 kHz
   
    OpenI2C(config1,config2);       // Execute configuration module
   
    EnableIntMI2C ;           //Enable interrupt module I2C in master mode
}

// write PCF8574A
void Write_PCF8574A(unsigned char dat)
{
    StartI2C() ;            // start I2C condition
   
    while(_SEN);            // wait until start ok
   
    MasterWriteI2C(PCF8574A_ID) ; // send ID into PCF8574A - write
    IdleI2C();              // wait condition until I2C bus is idle
    MasterWriteI2C(dat);    // send data
    IdleI2C();              // wait condition until I2C bus is idle
   
    StopI2C();              // stop I2C condition
    while(_PEN);            // wait until stop ok
}
// Read PCF8574A
unsigned char Read_PCF8574A(void)
{
    unsigned char indata ;
    StartI2C() ;            // start I2C condition
    while(_SEN);            // wait until start ok
   
    MasterWriteI2C(PCF8574A_ID + 1); // send ID into PCF8574A - read
    IdleI2C();              // wait condition until I2C bus is idle
    indata = MasterReadI2C(); // read data 8 byte from PCF8574A
    IdleI2C();              // wait condition until I2C bus is idle
   
    StopI2C();              // stop I2C condition
    while(_PEN);            // wait until stop ok
   
    return (indata);
}

int main(void)
{
    unsigned char i = 0, iData;
   
    Init_MI2C();        // initialize master I2C
   
    while(i++ < 10 )
    {
        Write_PCF8574A(0x0F);
        Delay_ms(100);
        Write_PCF8574A(0x00);
        Delay_ms(100);
    }
   
    while(TRUE)
    {
        iData = Read_PCF8574A();    // Read data
        iData = iData >> 4 ;        // shift to nibble low
        iData = iData | 0xF0 ;      // mark bit nibble high
         Write_PCF8574A(iData) ;    // out data
    }
    return 0;
}

A.NAT.J

เบื้องต้นลองปิด function ที่เรียกที่ละ  module ก่อนครับว่า เจอ error ที่ module ไหน ค่อยๆแก้ทีละส่วนจะเห็นภาพครับ.... :)

JimmyGrape

ใช้ MPLABX 3.30 ไม่ได้ครับ  ให้ใช้ MPLABX 2.35 ครับ และในฟังก์ชั่น Init_MI2C()  ค่าของ config1 ที่ก่อนวงเล็บปิดมี & เกินมาหนึ่งตัว
แล้วจะ compile ผ่านครับ


pumpuykung

ทำได้แล้วครับ ขอบคุณสำหรับคำตอบครับ