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

Discussion in 'C Programming' started by suresh, May 12, 2005.

  1. suresh

    suresh Guest

    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
     
    suresh, May 12, 2005
    #1
    1. Advertising

  2. 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
     
    August Karlstrom, May 12, 2005
    #2
    1. Advertising

  3. suresh

    Alex Fraser Guest

    "suresh" <> wrote in message
    news:...
    > 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
     
    Alex Fraser, May 12, 2005
    #3
  4. suresh

    suresh Guest

    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
     
    suresh, May 12, 2005
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Peng Yu
    Replies:
    6
    Views:
    6,438
    Method Man
    Oct 4, 2004
  2. Jianli Shen
    Replies:
    1
    Views:
    594
    Victor Bazarov
    Mar 13, 2005
  3. Ark
    Replies:
    1
    Views:
    421
    Chris Torek
    Aug 7, 2004
  4. Jon Slaughter
    Replies:
    4
    Views:
    450
    Jon Slaughter
    Oct 26, 2005
  5. Pierre Yves
    Replies:
    2
    Views:
    490
    Pierre Yves
    Jan 10, 2008
Loading...

Share This Page