473,396 Members | 1,996 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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

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

Nov 14 '05 #1
3 2148
suresh wrote:
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
Nov 14 '05 #2
"suresh" <si**********@gmail.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
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
Nov 14 '05 #3
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

Nov 14 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.