On Fri, 2013-06-07 at 18:29 +0800, JIA Pei wrote:
>
> So, is there any suggestions by using sdcc?
> How can I make the code both built and work successfully by compiling
> with sdcc ?

The following should work :

#include <8052.h>

#define RELAY P1_4
#define K1 P2_7

void main(void)
{
        if(!K1)
        {
                RELAY = 0;
        }
        else
        {
                RELAY = 1;
        }

        while(1)
        {
        }
}

You did not show which sdcc version you are using but you must
have had more errors then you told with your source.

roelofh@castle:~/test$ sdcc --std-sdcc89 test.c 
roelofh@castle:~/test$ sdcc -v
SDCC : mcs51 3.2.1 #8413 (Feb  8 2013) (Linux)

roelof




------------------------------------------------------------------------------
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