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

on-chip xdata on aduc832

Can anyone please help explaining me why this code won't access the on-chip xdata. When executing the below code nothing happens at all.

#include <ADUC832.H>
#include  <stdio.h>

void main (void)
{
  xdata int m[10];
  int j;
/*-----------------------------------------------
Configure the serial port to run at 9600 Baud.
-----------------------------------------------*/

        PLLCON = 0xF0; // core clock 16.78 MHz
        PCON |= 0x80;    // Set SMOD i.e. double baudrates
        SCON = 0x50;   // SCON: mode 1, 8-bit UART, enable rcvr
        TMOD = 0x20;   // TMOD: timer 1, mode 2, 8-bit reload
        TH1 = -9;            // TH1:  reload value for 9600 baud
        TR1 = 1;       // TR1:  timer 1 run
        TI = 1;

  for(j=0;j<10;j++)
    m[j] = j;

  for(j=0;j<10;j++)
        printf("int m[%i] = %i\n", j, m[j]);

        while(1);
}

In the startup code (START_AD.A51) I did enable xdata access

; XRAMEN     Val  Description
; ------     ---  -----------
XRAMEN EQU 1; 0 = disable on-chip XDATA RAM and access off-chip XDATA space
;           ; 1 = enable on-chip XDATA RAM

If I change to XRAMEN EQU 0 and run the code, the output is ten "-1" on the serial port (this I understand as xdata isn't available)

0