Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
01/25/02 13:42
Read: times


 
#19109 - RE: use of xdat


kishore gv wrote:
-------------------------------
hello
iam currently using demo version of tasking 8051 c compiler and facing following problem using keyword xdat

#include<stdio.h>
..
_xdat unsigned char buffer_at(0x2000);

main()
{
unsigned char p;

p=bufffer; /*reading data into ram*/
}
The problem is iam getting compilation error at xdat.please tell me the problem and solution...

I don't know why the syntax error but this was what was required for Raisonance. See if this helps.

#include <stdio.h>

xdata at 0x2000 unsigned char buffer = 0xff;

void main( void )
{
volatile unsigned char p;

p = buffer; /*reading data into ram*/
while (1) {};
}
Note, your declaration of the xdata variable buffer is "buffer" while the access within main is "bufffer". In addition main didn't have a return value, this generated a warning in our compiler. Also I don't know how good the optimizer is in Tasking but because P wasn't used we optimized it out. I used the volatile keyword to stop that.

To test I initialize buffer to 0xff and watched the setting of p to 0xff;

Perhaps you can use this code to figure out what is going wrong with your example.

List of 5 messages in thread
TopicAuthorDate
use of xdat            01/01/70 00:00      
RE: use of xdat            01/01/70 00:00      
RE: use of xdat            01/01/70 00:00      
RE: use of xdat            01/01/70 00:00      
RE: use of xdat            01/01/70 00:00      

Back to Subject List