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

Code simulates ok, but doesn't run in chip

Hi.

I have this simple code that defines some constants in code:

#include <REG922.H>

code const unsigned char LEDRegister0[] = {0xff,0xfe,0xfd,0xfb,0xff,0xff,0xff,0xff,0xf7,0xff,0xff,0xbf};

code const unsigned char LEDRegister1[] = {0x7f,0xff,0xff,0xff,0xef,0xfd,0xfb,0xf7,0xff,0xbf,0xfe,0xff};

code const unsigned char Pattern1[] = {54,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,19,21,25,27,30,33,36,40,45,50,50,45,40,36,33,30,27,25,21,19,19,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1};


code const unsigned char Pattern2[] = {54,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,19,21,25,27,30,33,36,40,45,50,50,45,40,36,33,30,27,25,21,19,19,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1};


code const unsigned char Pattern3[] = {54,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,19,21,25,27,30,33,36,40,45,50,50,45,40,36,33,30,27,25,21,19,19,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1};


void main()
{

unsigned char i;

P1M1 = 0;

for(;;)
{
P1 = 0xaa;
P1 = 0x55;
}

}

When I simulate this code it runs fine, but when I download it to my chip (an LPC920), it doesn't run.

I then remove the last constant definition named Pattern3, recompile and now the code simulates AND runs in the chip.

I started from the Blinky example and simply changed the target chip to compile. I'm using small memory model and small code size (2k or less).

If anyone can tell me what I'm doing wrong, I would be grateful.

Thanks,

Marc.

Parents
  • I found a solution to my problem, even though I don't fully understand what happened.

    When I program my chip using the ICP method with the MCB900 board, I get the errors mentionned previously. But I tried programming it using the ISP method (instead of the ICP method) and the code runs just fine, like the simulator predicted.

    I must have been doing something wrong with using the ICP method. I was however, able to reprogram the ISP code in FLASH using the ICP method.

    BTW, I now use Erik's NoTouch approach for ISP. I changed his code to a simple LJMP 0700H if the TX pin is held low (instead of being pulled up) on startup.

    Thanks everyone!
    :)

    Marc.

Reply
  • I found a solution to my problem, even though I don't fully understand what happened.

    When I program my chip using the ICP method with the MCB900 board, I get the errors mentionned previously. But I tried programming it using the ISP method (instead of the ICP method) and the code runs just fine, like the simulator predicted.

    I must have been doing something wrong with using the ICP method. I was however, able to reprogram the ISP code in FLASH using the ICP method.

    BTW, I now use Erik's NoTouch approach for ISP. I changed his code to a simple LJMP 0700H if the TX pin is held low (instead of being pulled up) on startup.

    Thanks everyone!
    :)

    Marc.

Children
No data