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

Parents
  • Okay, the code now works properly, at least, but the debugger isn't connecting. The notification reccs vs my actions:

    -Check that I'm sending on the right COM port. Done, and I am (COM 2).
    -Check that the ISD51 is linked to my application. Done: the .A51 file is included in my project, and I have #include "isd51.h" at the head of my main program.
    -Make sure that the loaded application matches the ROM content: Almost certain that they're the same, but I've no way to know for sure.
    -Review the initialization of the serial interface re: baudrate. Initialization code is posted. I'm trying for 9600 baud using a 16.384M crystal, on a Dallas DS89C450. This works in the simulator at 9450-ish, so I think it's right. I'll keep checking it, though.
    -The application must not disable the serial interrupt for more than 5 seconds. It doesn't.

    Frankly, this has got me pretty stumped. I've used a sniffer to verify that uVision is sending the right byte. I'll keep plugging at it, of course, but I could use the benefit of any experience you folks'd be willing to lend.

    Many Thanks,
    Bob Robertson.

Reply
  • Okay, the code now works properly, at least, but the debugger isn't connecting. The notification reccs vs my actions:

    -Check that I'm sending on the right COM port. Done, and I am (COM 2).
    -Check that the ISD51 is linked to my application. Done: the .A51 file is included in my project, and I have #include "isd51.h" at the head of my main program.
    -Make sure that the loaded application matches the ROM content: Almost certain that they're the same, but I've no way to know for sure.
    -Review the initialization of the serial interface re: baudrate. Initialization code is posted. I'm trying for 9600 baud using a 16.384M crystal, on a Dallas DS89C450. This works in the simulator at 9450-ish, so I think it's right. I'll keep checking it, though.
    -The application must not disable the serial interrupt for more than 5 seconds. It doesn't.

    Frankly, this has got me pretty stumped. I've used a sniffer to verify that uVision is sending the right byte. I'll keep plugging at it, of course, but I could use the benefit of any experience you folks'd be willing to lend.

    Many Thanks,
    Bob Robertson.

Children
No data