We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
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!
I'm with ibrahim hartavioglu on this one. Keil have a long history of providing single C51 part/family headers, not sure why they wouldn't at least offer the same for the EFM8, regardless of what SILabs do with other tools. Here's what I use for a current F340/F380 project:
#include <c8051f340.h> // SFR declarations
Done. All of those enum headers must have been some work. Can one be combined with a more generic header or do we still need a collection of headers to get one specific part functionality?
I have a paid Keil installation, as of C8051F38x anyway, and was hoping to gather the correct header for an EFM8 device I'm considering. I'm not an Eclipse fan, but it's been a couple of years since I tried it. I guess one has to make their own like someone has done above. Maybe we can create a repository someplace for these. I will look at the more convoluted method SILabs now uses also. Was thinking that since my EFM8 part is just another variant (deviant? Hi Erik), that a single header would get me off to the evaluation races..