This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Which header file to use with Silabs EFM8LB12F64

Dear all,

Would you help me to identify which header file to use with Silabs EFM8LB12F64E?

I already tried to compile a very simple program , but, failed.

 #include <SI_EFM8LB1_Register_Enums.h>
 sbit LED_Green = P1^4;

 sbit LED_Blue = P1^5;

 sbit LED_Red = P1^6;

 sbit PB0 = P0^2; //Push Button 0

 sbit PB1 = P0^3; //Push Button 1
  MCU_init(){

 // TO disable watchdog timer      do following

   WDTCN = 0xDE;

   WDTCN = 0xAD;

 //now, watchdog disabled
    CLKSEL = 0x88;     // Set system clock to 24.5 MHz
 //assign inputs

    P0MDIN=P0MDIN | 0x0C; //set bit 2 and 3 of P0 for DI

    P0MDOUT=P0MDOUT & 0xF3; // clear bit 2 and 3  of P0 for Open Drain

    P0^2 = 1;

    P0^3 = 1;
 //assign outputs

    P1MDIN=P1MDIN | 0x70; //set bit 4, 5 and 6 of P1 for DO

    P1MDOUT=P1MDOUT | 0x70; // set bit 4, 5 and 6 of P1 for Push-Pull

 }
 main()

 {

   MCU_init();
   while(1){
     if ( PB0 ^ PB1 )

      {

         LED_Green=1 ;

      }

           else

           {

           LED_Blue = PB0 ;

           LED_Red = PB1;

           }
           }

   }

Build operation resulted in following errors :

Build target 'Target 1'
compiling main.c...
..\main.c(1): warning C318: can't open file 'compiler_defs.h'
..\SI_EFM8LB1_Defs.h(34): warning C318: can't open file 'si_toolchain.h'
..\SI_EFM8LB1_Defs.h(39): error C141: syntax error near '0xE0'
..\SI_EFM8LB1_Defs.h(40): error C141: syntax error near '0xB6'
. .
. ..\SI_EFM8LB1_Defs.h(543): error C141: syntax error near '0xD8'
..\SI_EFM8LB1_Defs.h(544): error C141: syntax error near '0xD8'
..\main.c(5): error C202: 'P1': undefined identifier
..\main.c(6): error C202: 'P1': undefined identifier
..\main.c(7): error C202: 'P1': undefined identifier
..\main.c(8): error C202: 'P0': undefined identifier
..\main.c(9): error C202: 'P0': undefined identifier
..\main.c(13): error C202: 'WDTCN': undefined identifier
..\main.c(14): error C202: 'WDTCN': undefined identifier
..\main.c(18): error C202: 'CLKSEL': undefined identifier
..\main.c(21): error C202: 'P0MDIN': undefined identifier
..\main.c(22): error C202: 'P0MDOUT': undefined identifier
..\main.c(23): error C202: 'P0': undefined identifier
..\main.c(23): error C141: syntax error near '='
..\main.c(24): error C202: 'P0': undefined identifier
..\main.c(24): error C141: syntax error near '='
..\main.c(27): error C202: 'P1MDIN': undefined identifier
..\main.c(28): error C202: 'P1MDOUT': undefined identifier
..\main.c(37): error C202: 'PB0': undefined identifier
..\main.c(39): error C202: 'LED_Green': undefined identifier
..\main.c(43): error C202: 'LED_Blue': undefined identifier
..\main.c(44): error C202: 'LED_Red': undefined identifier
Target not created.
Build Time Elapsed: 00:00:01

It is obvious that the compiler cannot understand register names.

Please, help me to identify.

Best regards!

Parents
No data
Reply
  • They have to provide a functional header if they say that it was supported by C51.

    Sorry, but that is total rubbish.

    Any decent seasoned programmer (such as, for example, Erik or Per) would know this and would not be in the least bit surprised if a precise header file for their chip was not available.

    Besides which, IMHO having to check over a header file and compare it against device documentation is a very good way to ensure you are gaining familiarity with the part.

Children
  • KEIL has to provide a matching header.

    Keil does not have to do any such, here are 1000s of '51 derivatives. Also, the LB is quite new that if they were to do so, there has hardly been time.

    Keil could, of course, reassign their people to stop making compilers and make header files instead. What would you rather make yourself, a header file or a compiler?

    If you (sorry) think, you would realize that a C compiler does not 'know' anything about I/O, thus a perfect and to the spec C compiler does not include any header files