Macro Definition ---- read_XDATA(address)---

S

suresh

hello every one,

I am very immatured in C coding, and hence at that starting stage of
coding.The following two are defined as macors in the header file.Can
any one please exaplain what it actually means.

#define read_XDATA(address) *((unsigned char volatile xdata*)address))

and

#define write_XDATA(address, value) (*((unsigned char volatile
xdata*)address) = value)

I would be very helped if some one can explail what actually this
definition means..

Thanks in advance

Suresh
 
A

August Karlstrom

suresh said:
hello every one,

I am very immatured in C coding, and hence at that starting stage of
coding.The following two are defined as macors in the header file.Can
any one please exaplain what it actually means.

#define read_XDATA(address) *((unsigned char volatile xdata*)address))

and

#define write_XDATA(address, value) (*((unsigned char volatile
xdata*)address) = value)

I would be very helped if some one can explail what actually this
definition means..

Thanks in advance

Suresh
Where's xdata defined?

-- august
 
A

Alex Fraser

suresh said:
I am very immatured in C coding, and hence at that starting stage of
coding.The following two are defined as macors in the header file.Can
any one please exaplain what it actually means.

#define read_XDATA(address) *((unsigned char volatile xdata*)address))

and

#define write_XDATA(address, value) (*((unsigned char volatile
xdata*)address) = value)

That requires guesswork as "xdata" is not defined by standard C.

I would not be surprised to see the above in a compiler for an 8051 (or
derivative) microcontroller, where use of the macros would cause the
compiler to produce code that reads/writes a byte from the specified
external data memory address using a MOVX instruction.

Alex
 
S

suresh

hi
Thank you very much for the reply..Yes u r right the the code is to
write a communication protocol between an RFID and ASIC with 8051
microcontroller.
The task is as follows ....

the RFID IC is connected to a ASIC with a 3 serial port, SLOCK,DIN and
Dout............now i need to wake up the IC which is possible by
sending a a low to high signal on DIN while clock is high, for this
pocess (to wake the IC from sleep mode) the SCLOCK and DIN as called as
a fucntion, the SCLOCK function and DIN are to controlled manually
using some utility functionm calls.
so in the functions CLOCK and DIN the following two defintion are
defined ....now by calling the function sclock and DIn the IC should
woke up....

#define read_XDATA(address) *((unsigned char volatile xdata*)address))
and
#define write_XDATA(address, value) (*((unsigned char volatile
xdata*)address) = value)

any suggestions please ...

with regards
suresh
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,479
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top