Hi,
 
Thanks for the suggestion. It works for the small test program (for testing the 7 segment display) but it doesn't work for another project file that i am working on..... I don't know why if i defined the base address for external ram (ensure that the address is higher than the code address) then the 7 segment display does not display accordingly to digit[]. But if i leave the external ram to default 0 (sdcc default when left undefined) then the 7 segment display will display digit[] data accordingly.
 
The reason why i tried to set the base address for external ram --xram-loc because i am afraid there would conflict between the code and external space since both by default is set to 0. Or this should not be a concern because it won't affect the program execution?
 
 
Thanks in advance for any comments and suggestion.


"Muller Jaco <jjmuller@sun.ac.za>" <jjmuller@sun.ac.za> wrote:
Try to assign an absolute memory address to your data, eg

xdata at 0x1000 BYTE Digit[]={ 0xc0, 0xf9, 0xa4, 0xb0, 0x99, 0x92, 0x82, 0xf8, 0x80, 0x98, 0x88, 0x83, 0xc6, 0xa1, 0x86, 0x8e};

j

-----Original Message-----
From: sdcc-user-admin@lists.sourceforge.net [mailto:sdcc-user-admin@lists.sourceforge.net] On Behalf Of leynie lee
Sent: 15 October 2004 05:21 AM
To: sdcc-user@lists.sourceforge.net
Subject: [Sdcc-user] --xram-loc

Hi all,

I observed different results if i define the xdata space compared to if i leave it to start at address 0. I wrote a test program just to test the result of 7 segment display on the FX2 board.

This is how the data are defined:

BYTE xdata Digit[]={ 0xc0, 0xf9, 0xa4, 0xb0, 0x99, 0x92, 0x82, 0xf8, 0x80, 0x98, 0x88, 0x83, 0xc6, 0xa1, 0x86, 0x8e};

snippet:

void main(void)
{
  for( i=0; i<=14; i++)
 {
  EZUSB_WriteI2C(LED_ADD, 0x01, &(Digit[i]));
 EZUSB_Delay(300); 
 }
}

If this file is compiled without using the option --xram-loc then after downloading the hex file onto the board, the 7 segment display will display from 0 to E accordingly. If the file is compiled with --xram-loc 0x1000 (for example), then weird figure will be displayed on the 7 segment display.

The reason why the --xram-loc option is used because i need to set the xdata space for the project file to avoid conflict with the code space since both by default map to address 0.

Does anyone know why this is happening and how i could remedy it?

Any suggestions and comments is much appreciated.

I am using the following version of SDCC:

SDCC : mcs51/gbz80/z80/avr/ds390/pic16/pic14/TININative/xa51/ds400/hc08 2.4.0 (Feb 23 2004) (MINGW32)

Thanks in advance!

 

Best regards,

Leynie


Do you Yahoo!?
vote.yahoo.com - Register online to vote today!


Do you Yahoo!?
vote.yahoo.com - Register online to vote today!