I'm just trying to write my first C8051 program:

__sfr __at(0xa0) P2;
__sfr __at(0xa6) P2MDOUT;
__sfr __at(0xe2) XBR1;

unsigned long int u = 0;
#define u 0ul

void main(void)
{
        // Enable port output
        XBR1 = 0x40;
        P2MDOUT = 0x0c;

        for(;;)
                P2 = ((u / 10) & 0x03) << 2;
}

My board has LED on the P2.2 and P2.3. This program turns them off. But
when I remove the "#define u 0ul" line the LEDs are on.
I compile using
sdcc test.c
and put the program onto the µC using
ec2writeflash --port USB --hex /tmp/test.ihx

Philipp

P.S.: Using
sdcc 3.6.2 #9727

------------------------------------------------------------------------------
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to