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

Array initialization in c8051F320

I'm trying to fill an array in xdata with zeros as follows:

unsigned char n; //Index to scan the array
unsigned char xdata bt[100]; //The array to fill

for(n=0;n<100;n++){ bt[n]=0; }

But when the array size is bigger than 38 elements the MCU hangs.
Does anybody know the reason why this happens?

Parents
  • Hi Erik!
    thanks for your reply.
    Below the Memory map:
    TYPE BASE LENGTH RELOCATION SEGMENT NAME
    -----------------------------------------------------
    * * * * * * * D A T A M E M O R Y * * * * * * *
    REG 0000H 0008H ABSOLUTE "REG BANK 0"
    REG 0008H 0008H ABSOLUTE "REG BANK 1"
    DATA 0010H 0002H UNIT ?DT?_WAIT?SMARTNODE 0012H 000EH *** GAP ***
    BIT 0020H.0 0002H.4 UNIT ?BI?SMARTNODE
    BIT 0022H.4 0001H.1 UNIT _BIT_GROUP_
    BIT 0023H.5 0000H.1 UNIT ?BI?_UART_SEND_COMMAND?SMARTNODE 0023H.6 0000H.2 *** GAP ***
    DATA 0024H 001DH UNIT ?DT?SMARTNODE
    DATA 0041H 0015H UNIT _DATA_GROUP_
    IDATA 0056H 0001H UNIT ?STACK
    * * * * * * * X D A T A M E M O R Y * * * * * * *
    XDATA 0000H 03F0H UNIT ?XD?SMARTNODE
    XDATA 03F0H 0065H UNIT _XDATA_GROUP_
    As I was wondering if the problem was caused by WDT I also disabled the WDT at the very beginning of the main with PCA0MD &= ~0x40; but it doesn't help

Reply
  • Hi Erik!
    thanks for your reply.
    Below the Memory map:
    TYPE BASE LENGTH RELOCATION SEGMENT NAME
    -----------------------------------------------------
    * * * * * * * D A T A M E M O R Y * * * * * * *
    REG 0000H 0008H ABSOLUTE "REG BANK 0"
    REG 0008H 0008H ABSOLUTE "REG BANK 1"
    DATA 0010H 0002H UNIT ?DT?_WAIT?SMARTNODE 0012H 000EH *** GAP ***
    BIT 0020H.0 0002H.4 UNIT ?BI?SMARTNODE
    BIT 0022H.4 0001H.1 UNIT _BIT_GROUP_
    BIT 0023H.5 0000H.1 UNIT ?BI?_UART_SEND_COMMAND?SMARTNODE 0023H.6 0000H.2 *** GAP ***
    DATA 0024H 001DH UNIT ?DT?SMARTNODE
    DATA 0041H 0015H UNIT _DATA_GROUP_
    IDATA 0056H 0001H UNIT ?STACK
    * * * * * * * X D A T A M E M O R Y * * * * * * *
    XDATA 0000H 03F0H UNIT ?XD?SMARTNODE
    XDATA 03F0H 0065H UNIT _XDATA_GROUP_
    As I was wondering if the problem was caused by WDT I also disabled the WDT at the very beginning of the main with PCA0MD &= ~0x40; but it doesn't help

Children