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!
The compiler has given very good information:
..\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'
Have you followed it through?
ask here
community.silabs.com/.../Forum
Doesn't the Simplicity Studio do this all for you ? www.silabs.com/.../simplicity-studio
It's made by SiLabs, specifically for SiLabs products!
Thanks for the recommendation!
I'm using Keil uVision 5. There are lots of header files for different manufacturers. Isn't there any for EFM8LB12F64? There should be a single file which is similar to reg51.h
Regards!
I don't want to use simplicity studio. Keil is nice and common platform.
Well, you could just create a dummy project in Simplicity - that would show you where all the headers are.
Then you can use them in Keil ...
AIUI, those files are provided by the device manufacturer.
I guess that SiLabs are focussed on providing headers for their own tool?
Doesn't Simplicity use the Keil compiler anyhow?
"There should be a single file which is similar to reg51.h"
Should there? Says who?
http://www.keil.com/dd/chips/siliconlabs/8051.htm
http://www.keil.com/dd/chip/8030.htm - indeed; no header listed.
Again, I'd guess that SiLabs are just putting it all into their own tool.
"Keil is ... common platform"
Actually, Simplicity Studio is Eclipse - which is a far more common platform!
it does, even a free full version
Silabs make header files for simplicity studio which looks to be based on eclipse IDE. I checked both Silabs and Keil's header files. Interestingly, Keil uses exactly same header files as Simplicity Studio which are located under /silabs/EFM8LB1 folder (3 files).
I opened those and found that they are not using syntax of Keil header files. I modified the one that includes register definition and addresses myself.
It works now.
I really surprised !?
Do I have to modify Keil's header files each time I use a different MCU? It looks weird. really!
I guess that SiLabs are focused on providing headers for their own tool?
they do with some involved macros to make them Keil and SDCC compatible. Thus, just including the header w/o the associated macro(s) will not work
I removed everything, but register definitions and addresses.
It works smoothly. No problem at all.
not necessarily, only for those tat are 'universal'
Didn't Erik just say that you can use the SiLans headers:
"they do with some involved macros to make them Keil and SDCC compatible. Thus, just including the header w/o the associated macro(s) will not work"
he did, maybe answering related to the posted problem made it unclear
rephrasing my post
"they do with some involved macros to make them Keil and SDCC compatible. Thus ...including the header with the associated macro(s) will work"