To whom it may concern:

I kept obtaining the following error message
*error 2: Initializer element is not constant*
while building the following code using *MCU8051IDE*, from Compiler
configuration, *MCU8051IDE *adopts *--std-sdcc89* .

*1) Code A*
*#include <reg51.h>*
*sbit RELAY = P1^4;*
*sbit K1    = P2^7;*
*
*
*main()
*
*{*
*  if (!K1) RELAY = 0;*
*  else RELAY = 1;   *
*}*

Clearly, *sdcc89* is not *keil C*, which is fantastic ! However, it seems
if I modify the above code and change it into

*1) Code B*
*#include <reg51.h>*

*main()
*
*{*
*sbit RELAY = P1^4;*
*sbit K1    = P2^7;*
*  if (!K1) RELAY = 0;*
*  else  RELAY = 1;    *
*}*

the above *code B* can be successfully built. However, after I did *hex->bin
* and flash the *.bin* file into my board, the board doesn't work at all.
However, by building *code A* and flashing the *.hex* file using
*PZ-ISP*under Windows, the board works fine.


So, is there any suggestions by using sdcc?
*How can I make the code both built and work successfully by compiling with
sdcc?*


Thank you very much.

-- 

Pei JIA

Email: jp4w...@gmail.com
cell:    +1 604-362-5816

Welcome to Vision Open
http://www.visionopen.com
------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. A cloud service to automate IT design, transition and operations
2. Dashboards that offer high-level views of enterprise services
3. A single system of record for all IT processes
http://p.sf.net/sfu/servicenow-d2d-j
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to