This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

I2C library not work



Hello, I have a problem with using the library "USI_I2CMaster.h. He writes me the following errors:

errors encountered during linking; "TestF2012.out" not built TestF2012 line 0 1294421001531 703

unresolved symbol StatusCallback, first referenced in ./TestF2012.obj TestF2012 line 0 1294421001531 697

unresolved symbol TI_USI_I2C_MasterInit, first referenced in ./TestF2012.obj TestF2012 line 0 1294421001531 702

unresolved symbol TI_USI_I2CRead, first referenced in ./TestF2012.obj TestF2012 line 0 1294421001531 698

unresolved symbol TI_USI_I2CSelect, first referenced in ./TestF2012.obj TestF2012 line 0 1294421001531 699

unresolved symbol TI_USI_I2CStop, first referenced in ./TestF2012.obj TestF2012 line 0 1294421001531 700

unresolved symbol TI_USI_I2CWrite, first referenced in ./TestF2012.obj TestF2012 line 0 1294421001531 701


I know with the Board. using CCS. Error in my code, it will not because it says it'll usethe same even if the model code. Sometimes I guess wrong compiler settings orsomething. Thank you very much.

  • No one really know? The problem still persists. Please for your help. Here is my code. I know it's probably more mistakes but I am trying to do was compile with the library.

     

    #include "msp430x20x2.h"

    #include "USI_I2CMaster.h"

     

     

    #define LAMP_ON  P1DIR |=  BIT0 /* Žárovka na P1.0 zapnua */

    #define LAMP_OFF P1OUT ^=  BIT0 /* Žárovka na P1.0 vypnuta */

     

    char Hour[] = {00,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23};  /* Proměnná "Hour" nabývá hodnot 00-23 */

     

    int StatusCallback(unsigned char c); 

     

    void main(void)

    {

      WDTCTL = WDTPW+WDTHOLD;                   /* Watchdog vypnut */

      if (CALBC1_1MHZ ==0xFF || CALDCO_1MHZ == 0xFF)       /* Pokud je hodnota kalibrace vymazána */                              

      {  

        while(1);                               /* Nespouštět */ 

     

      }   

      BCSCTL1 = CALBC1_1MHZ;                    /* Nastavení frekvence DCO */

      DCOCTL = CALDCO_1MHZ;

     

    for(;;)

    {

    void DS1307Settime(char Hour);

    {

    TI_USI_I2C_MasterInit(USIDIV_7+USISSEL_2+USICKPL, StatusCallback); /* Inicializace I2C */

    TI_USI_I2CSelect(68); /* Adresa DS1307 */

    __disable_interrupt();

    TI_USI_I2CRead(68, 3, 1,00); /* Čtení z adresy 02, 24hodinový režim, hodnota hodin uložena do proměnné "Hour" */

    __bis_SR_register(LPM0_bits + GIE);

    __disable_interrupt();

    TI_USI_I2CWrite(68, 3, 1,Hour); /* Zápis Hodin do uvolněné adresy RAM */

    __bis_SR_register(LPM0_bits + GIE);

    TI_USI_I2CStop();           /* Stop I2C */

    }

     

    void Lamp(char Hour);

    {

     

    if(Hour == "9")

    {

    LAMP_ON; /* V 9 hodin zapnout */

    }

    if(Hour == "21")

    {

    LAMP_OFF; /* Ve 21 hodin vypnout */

    }

     

    }

    }

    }

  • Still, you never know? I ask everyone who knows how to do it. Perhaps another wayMy point is this: I get the time from the DS1307, and will switch on and off the LED inthe desired time

  • Recent findings: In the IAR, it is compiled, but still can not debug. It says the samemistakes as in CCS.

  • So I'm in the "File Search Patch" set " *.s43" and writes that these errors:

     

    cannot open file "./RTC.obj":  No error 
    expecting filename, option, MEMORY, or SECTIONS instead of ";" 

     

    Please Help Me

  • The above errors are no compile rerrors. So it isn't a problem with your code.

    When compiling, you somehow tell the compile the mentioned symbols exist - probably by including a .h file that define sthem.

    ut then when the linekr tries to link the generated code, it cannot find these symbols anywhere. There is no code for them in any of the code parts you provide to the linker.

    The the most likely reason is that this code is in a library code file and you forgot to add it to your project, so it isn't linked.
    Either the library code is porvided as precompiled library, then ou need to add it to the linker options, or it is provided as source code, then you need to add this code to your project code files, so it gets compiled and then linked.

    Marek Prochazka said:
    sing the library "USI_I2CMaster.h

    That's the mistake: 'USI_I2CMaster.h' is not a library. It is a header file describign what can be found in the library. It does not contain any of the code. There must be either a .c file of the same name (then it is source code and needs to be added to your projects source files) or a library object file such as *.obj, *.a, *.lib or similar (depending on your compiler and the provided library data)

  • Thank you very much for your help. Sending screen as it looks now. Library ".s43" to incorporate a successful, but it says a lot of mistakes Assembler. Please help to continue. About the compiler does not translate to the assembler. Thank you very much.

     

    http://imgmb.com/?display&image&c=f2a0eed1f425&i=Screen.jpg

  • That's really strange. From what I can see from your screenshot, the assembler run (that happens after the C compiler run) does not know how to handle USIPE7. USIPE7, however, is a value and shouldn't be forwarded from the compiler to the assembler at all. Else the compiler should complain about undefined labels. But the compiler doesn't, so they are defined somewhere somehow, yet not in a way that the compiler will resolve them and forward their values to the assembler.

    It looks like the sources you got (the header files), which are defining this stuff, are not compatible with your compiler.

    It's likely that they are for the IAR and you use them in CCS. YOu mus tinclude the proper version for your compiler suite.

  • I tried it, but even IAR and it's the same. I really do not know what it :-( When that file (. S43) give the IAR project folder so you can not findit myself. Where do I put so? Thank you very much.

  • I'm sorry but I cannot help you further. I do not use IAR or CCS, in fact I do not even have them installed (I use mspgcc). So I cannot check what's needed and where.

    Perhaps someone else with more experience on these tools has an idea.

    Or you start another thread in the CCS forum.

  • Hello,

    It sounds like you have a problem with the files that are included and perhaps the project setting?

    What version of IAR are you using?

    If it helps I can create an IAR project with the necessary files and send you a zip.

    Regards,

    Priya

  • Hi, many thanks for your support. I have version 5.20.1. My code I put in my profile(Files). So in CCS that your library does not work? Otherwise, that my code is certainlya lot of mistakes because I'm a beginner :-) but find it hard to learn when I do not allowdevelopment environment. With the code I do not need help. Just so I could finallycompile. Thank you very much.

  • Please always help :-( Still, I did not move anywhere. Thank you very much.

**Attention** This is a public forum