Re: [Sdcc-user] error 2:Initializer element is not constant?

2011-03-22 Thread Krishnendu Chatterjee
Hi Donald, The keyword 'sbit' is used to define special function bits, much like the keyword 'sfr' for the special function registers. The good news is that most of the SFRs in 8051 are already defined in <8051.h> Thus to set the 4th bit of PORT-2 to 0, use the following code: #include <8051.h>

Re: [Sdcc-user] error 2:Initializer element is not constant?

2011-03-22 Thread Maarten Brock
Hi, Keil uses a very strange symbols (^, =) to define a bit in an sfr. To standard C they mean 'xor' and 'assign' and thus SDCC treats them as such. sbit P10 = P1^0; SDCC sees a definition of an sbit called P10 and it is INITIALIZED with the value of P1 XOR 0x00. The value of sfr P1 is not const

Re: [Sdcc-user] error 2:Initializer element is not constant?

2011-03-22 Thread roelof 't Hooft
On Tue, 2011-03-22 at 10:02 +0800, duck donal wrote: > Hi All, > I'm a newbie for sdcc. > A few days ago, I was in use of SDCC, ran into a problem. > So,what is the solutions?To modify the program?How to do it? > Or modify the sdcc? Hi Donald, Here is your example code back, I modified it a bit

Re: [Sdcc-user] error 2:Initializer element is not constant?

2011-03-22 Thread duck donal
Hi roelof, Thanks for your help! I run what you modify code in my pc,It can be compiled successfully! However I have some questions to this code. 1.What you use library files(p89lpc938.h) seems not the standard 51 library files.Does that mean I can subsitute this library for standard 51

Re: [Sdcc-user] error 2:Initializer element is not constant?

2011-03-22 Thread duck donal
Hi Maarten, I want to know more about SDCC internal information,such as the SDCC compile flow,What is the difference between SDCC and GCC how SDCC combine the front-end with back-end,will SDCC generate RTL stuff like that? I know you are a superior,so could u give me some detail materials? Th

Re: [Sdcc-user] error 2:Initializer element is not constant?

2011-03-22 Thread Krishnendu Chatterjee
Hi Donald, I am trying to re-clarify the concept of __sfr and __sbit. The statement '__sfr __at 0x9A MY_SFR' means that a new SFR is declared at 0x9A which is identified by the name MY_SFR in this program. However, this does not mean that MY_SFR.0 or MY_SFR_0 can be used to access the 'bit 0' of

Re: [Sdcc-user] error 2:Initializer element is not constant?

2011-03-22 Thread duck donal
Hi,Krish Thank you so much for answering my questions detailedly! I‘ve got it.Thus next time I'll check the <.h> file to find out the specific register name of machine in SDCC. Now I really want to know what SDCC compile flow is.How a c code become to be a assembly code,even the machine c