This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

ISD51 Wierdness

This is breaking my brain, a bit at a time...
Code like this works perfectly:

void initSerialPorts(void){
        EA=1;//enable interrupts
        ES0=1;//enable serial port interrupts
        SCON0= 0xD0;//put serial ports into mode 3
        TMOD |=0x20;//put timer 1 into mode 2
        TL1=247;
        TH1=247;//value to set timer to after it rolls over
        TR1=1;//start timer 1 running
        TB8_0=0;//9th data bit
        SMOD_1=1;//doubler bits for both serial ports
        PCON |= 0x80;
        EWDI = 0;//disable watchdog timer interrupt
        return;
}

void sample(void){
        return;
}

main()
{
        int x=1;
        P1=0x00;//complete LED circuit
        sample();
        initSerialPorts();
        P3=0x00;
        //ISDwait();
        while(1){
                x++;
        }
}

The ports are being cleared to activate a pair of LEDs, because I can't seem to get the debugger to work properly.
Code like this doesn't seem to return from the call to initSerialPorts():

main()
{
        int x=1;
        P1=0x00;//complete LED circuit
        sample();
        initSerialPorts();
        P3=0x00;
        ISDwait();
        while(1){
                x++;
        }
}


The two function definitions haven't changed. I suspect the call stack is being damaged at some point, but I don't know how. The code works perfectly in the simulator.

Because I'm a neophyte to the Keil products and microcontrollers in general, I strongly suspect a configuration error at some point. Should I also post the ISD51.H file?

Many thanks for any ideas,
Bob Robertson

0