ADUC842 Keil ,xdata access ?

Hello to you all

i'm trying to do an application with an ADUC842,i'm using the limited Keil C51 freeware environment

my problem is that i cant retrieve data in the XDATA area,and i have instead its address

e.g

unsigned char xdata ucxtest=0xF3 // i declare an unsigned char: in XDATA ,the compiler allocate it say at address 0x20

sendbyte(ucxtest);//the value is passed to a tx function sending it through UART to a terminal //prototype was void sendbyte(unsigned char);

well,in the simulation everything works fine,but actually the value sent by UART is not ucxtest=0xF3 but its address (0x20)

why? thanks

Reply to
blisca
Loading thread data ...

Are you 101% sure you actually _have_ XDATA? And that it's been activated, by setting the relevant SFR(s) to the right value(s)?

I ask because there's a very well-known effect where RAM that doesn't exist, on a '51, will look like every address contains its own low-byte for data.

Reply to
Hans-Bernhard Bröker

instead

Reading just now,sorry

I enabled the flag( just one bit,correct?) in CFG842,but the situation didn't change

i solved 2 days ago specifying an absolute address with _at_

e.g unsigned char data xTestVal _at_ 0x.....

If you have some links about that very well known effect i will be pleased to read it

Thanks! Have a nice week end Diego

Reply to
blisca

news:gs33sp$por$03$ snipped-for-privacy@news.t-online.com...

d

I'm not at all a CFG842 expert but you might want to add the keyword volatile to avoid compiler optimization.

Reply to
gobraves

How would I know? It's your pick of controller, so you read the datasheet.

Then maybe, just maybe, it was more than one bit...

Not, that most probably didn't solve anything. That "solution" is a red herring. It's entirely possible that your problem was never what you thought it was.

You don't need a link. Just sit down and imagine, in detail, what happens on an 8051's multiplexed address/data bus as you read from an actual, external RAM chip. Then imagine what the electronics will most likely do if the RAM chip isn't installed.

Reply to
Hans-Bernhard Bröker

datasheet.

pleased

well,in this case probaly i would read the last thing that was on that bus:the address low byte

Reply to
blisca

"blisca" ha scritto nel messaggio news:49eb6d65$0$1113$ snipped-for-privacy@reader3.news.tin.it...

sorry,my last message was incomplete> >

thanks,at first for your hints

maybe EXSP=0 so to reserve the XRAM space for data only???

but in my case i expect that the existing xram could "immediately" present a data

other clues? thanks Diego

Reply to
blisca

Maybe. But like I said, it's your pick of controller, so you better read and understand its data-sheet yourself.

_If_ it's actually activated and correctly wired, it will. But I don't think we have established that, have we?

Reply to
Hans-Bernhard Bröker

pick....from the scratch actually,i had availability of some broken boards,my intention was to practice a bit with a uc of 8051 family

i red many times the datasheet sections that i think being inherent to this issue,maybe not enough carefully,

do you think i should spend again hours reading the spi or i2c chapter?i took a look,but i planned to spent more time on it at the moment i need it.Do you consider it wrong?

present a

well,i dont know if it is activated,but being internal to the uC i hope that it is wired at least

Reply to
blisca

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.